Package reactor.netty.http.websocket
Interface WebsocketOutbound
- All Superinterfaces:
NettyOutbound
,Publisher<Void>
A websocket framed outbound.
- Since:
- 0.6
- Author:
- Stephane Maldini, Simon Baslé
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Function<? super ByteBuf,
? extends WebSocketFrame> static final Function<? super String,
? extends WebSocketFrame> -
Method Summary
Modifier and TypeMethodDescription@Nullable String
Returns the websocket subprotocol negotiated by the client and server during the websocket handshake, or null if none was requested.Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).Prepare to send a close frame on subscribe then close the underlying channel.sendClose
(int rsv) Prepare to send a close frame on subscribe then close the underlying channel.Prepare to send a close frame on subscribe then close the underlying channel.Prepare to send a close frame on subscribe then close the underlying channel.default NettyOutbound
sendString
(Publisher<? extends String> dataStream, Charset charset) Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error).Methods inherited from interface reactor.netty.NettyOutbound
alloc, neverComplete, send, sendByteArray, sendFile, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendObject, sendString, sendUsing, subscribe, then, then, then, withConnection
-
Field Details
-
stringToWebsocketFrame
-
bytebufToWebsocketFrame
-
-
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
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 interfaceNettyOutbound
- 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
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
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
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
Prepare to send a close frame on subscribe then close the underlying channel.- Parameters:
rsv
- reserved bits used for protocol extensionsstatusCode
- 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
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 interfaceNettyOutbound
- Parameters:
dataStream
- the dataStream publishing Buffer items to write on this channelcharset
- the encoding charset- Returns:
- A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
-