Top Description Fields Methods
reactor.netty5.http.websocket

public Interface WebsocketOutbound

extends NettyOutbound
Known Direct Implementers
reactor.netty5.http.client.WebsocketClientOperations, reactor.netty5.http.server.WebsocketServerOperations
Imports
java.nio.charset.Charset, java.util.function.BiFunction, .Function, io.netty5.buffer.Buffer, .BufferAllocator, io.netty5.handler.codec.http.websocketx.BinaryWebSocketFrame, .TextWebSocketFrame, .WebSocketFrame, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, reactor.netty5.NettyOutbound, reactor.util.annotation.Nullable

A websocket framed outbound
Authors
Stephane Maldini, Simon Baslé
Since
0.6

Field Summary

Modifier and TypeField and Description
public static final Function<? super Buffer, ? extends WebSocketFrame>
public static final BiFunction<? super BufferAllocator, ? super String, ? extends WebSocketFrame>

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the subprotocol, or null
selectedSubprotocol
()

Returns the websocket subprotocol negotiated by the client and server during the websocket handshake, or null if none was requested.

public NettyOutbound
send(Publisher<? extends Buffer>
the dataStream publishing OUT items to write on this channel
dataStream
)

Redeclares as abstract: reactor.netty5.NettyOutbound.send.

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).
public Mono<Void>

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

public Mono<Void>

Returns:

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
sendClose
(int
reserved bits used for protocol extensions
rsv
)

Prepare to send a close frame on subscribe then close the underlying channel

public Mono<Void>

Returns:

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
sendClose
(int
Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.
statusCode
,
String
Reason text. Set to null if no text.
reasonText
)

Prepare to send a close frame on subscribe then close the underlying channel

public Mono<Void>

Returns:

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed
sendClose
(int
reserved bits used for protocol extensions
rsv
,
int
Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.
statusCode
,
String
Reason text. Set to null if no text.
reasonText
)

Prepare to send a close frame on subscribe then close the underlying channel

public default NettyOutbound
sendString(Publisher<? extends String>
the dataStream publishing Buffer items to write on this channel
dataStream
,
Charset
the encoding charset
charset
)

Overrides default reactor.netty5.NettyOutbound.sendString.

Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error).
Inherited from reactor.netty5.NettyOutbound:
allocneverCompletesendsendByteArraysendFilesendFilesendFileChunkedsendGroupssendObjectsendObjectsendObjectsendStringsendUsingsubscribethenthenthenwithConnection

Field Detail

bytebufToWebsocketFrameback to summary
public static final Function<? super Buffer, ? extends WebSocketFrame> bytebufToWebsocketFrame
stringToWebsocketFrameback to summary
public static final BiFunction<? super BufferAllocator, ? super String, ? extends WebSocketFrame> stringToWebsocketFrame

Method Detail

selectedSubprotocolback to summary
public String selectedSubprotocol()

Returns the websocket subprotocol negotiated by the client and server during the websocket handshake, or null if none was requested.

Returns:String

the subprotocol, or null

Annotations
@Nullable
sendback to summary
public NettyOutbound send(Publisher<? extends Buffer> dataStream)

Redeclares as abstract: reactor.netty5.NettyOutbound.send.

Doc from reactor.netty5.NettyOutbound.send.

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.

Parameters
dataStream:Publisher<? extends Buffer>

the dataStream publishing OUT items to write on this channel

Returns:NettyOutbound

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.

Annotations
@Override
sendCloseback to summary
public Mono<Void> sendClose()

Prepare to send a close frame on subscribe then close the underlying channel

Returns:Mono<Void>

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed

sendCloseback to summary
public Mono<Void> sendClose(int rsv)

Prepare to send a close frame on subscribe then close the underlying channel

Parameters
rsv:int

reserved bits used for protocol extensions

Returns:Mono<Void>

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed

sendCloseback to summary
public Mono<Void> sendClose(int statusCode, String reasonText)

Prepare to send a close frame on subscribe then close the underlying channel

Parameters
statusCode:int

Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.

reasonText:String

Reason text. Set to null if no text.

Returns:Mono<Void>

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed

Exceptions
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.
sendCloseback to summary
public Mono<Void> sendClose(int rsv, int statusCode, String reasonText)

Prepare to send a close frame on subscribe then close the underlying channel

Parameters
rsv:int

reserved bits used for protocol extensions

statusCode:int

Integer status code as per RFC 6455#section-7.4. For example, 1000 indicates normal closure.

reasonText:String

Reason text. Set to null if no text.

Returns:Mono<Void>

a Mono fulfilled when the send succeeded or failed, immediately completed if already closed

Exceptions
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.
sendStringback to summary
public default NettyOutbound sendString(Publisher<? extends String> dataStream, Charset charset)

Overrides default reactor.netty5.NettyOutbound.sendString.

Doc from reactor.netty5.NettyOutbound.sendString.

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.

Parameters
dataStream:Publisher<? extends String>

the dataStream publishing Buffer items to write on this channel

charset:Charset

the encoding charset

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

Annotations
@Override