Interface WebsocketOutbound

All Superinterfaces:
NettyOutbound, Publisher<Void>

public interface WebsocketOutbound extends NettyOutbound
A websocket framed outbound.
Since:
0.6
Author:
Stephane Maldini, Simon Baslé
  • Field Details

  • Method Details

    • selectedSubprotocol

      @Nullable String selectedSubprotocol()
      Returns the websocket subprotocol negotiated by the client and server during the websocket handshake, or null if none was requested.
      Returns:
      the subprotocol, or null
    • send

      NettyOutbound send(Publisher<? extends ByteBuf> dataStream)
      Description copied from interface: NettyOutbound
      Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

      A new NettyOutbound type (or the same) for typed send sequences.

      Note: Nesting any send* method is not supported.

      Specified by:
      send in interface NettyOutbound
      Parameters:
      dataStream - the dataStream publishing OUT items to write on this channel
      Returns:
      A new NettyOutbound to append further send. It will emit a complete signal successful sequence write (e.g. after "flush") or any error during write.
    • sendClose

      Mono<Void> sendClose()
      Prepare to send a close frame on subscribe then close the underlying channel.
      Returns:
      a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
    • sendClose

      Mono<Void> sendClose(int rsv)
      Prepare to send a close frame on subscribe then close the underlying channel.
      Parameters:
      rsv - reserved bits used for protocol extensions
      Returns:
      a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
    • sendClose

      Mono<Void> sendClose(int statusCode, @Nullable String reasonText)
      Prepare to send a close frame on subscribe then close the underlying channel.
      Parameters:
      statusCode - Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.
      reasonText - Reason text. Set to null if no text.
      Returns:
      a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
      Throws:
      IllegalArgumentException - when the status code MUST NOT be set as a status code in a Close control frame. Consider checking RFC 6455#section-7.4 for a complete list of the close status codes.
    • sendClose

      Mono<Void> sendClose(int rsv, int statusCode, @Nullable String reasonText)
      Prepare to send a close frame on subscribe then close the underlying channel.
      Parameters:
      rsv - reserved bits used for protocol extensions
      statusCode - Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.
      reasonText - Reason text. Set to null if no text.
      Returns:
      a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
      Throws:
      IllegalArgumentException - when the status code MUST NOT be set as a status code in a Close control frame. Consider checking RFC 6455#section-7.4 for a complete list of the close status codes.
    • sendString

      default NettyOutbound sendString(Publisher<? extends String> dataStream, Charset charset)
      Description copied from interface: NettyOutbound
      Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.

      Note: Nesting any send* method is not supported.

      Specified by:
      sendString in interface NettyOutbound
      Parameters:
      dataStream - the dataStream publishing Buffer items to write on this channel
      charset - the encoding charset
      Returns:
      A Publisher to signal successful sequence write (e.g. after "flush") or any error during write