Top Description Fields Constructors Methods
reactor.netty5.http.server

pack-priv final Class WebsocketServerOperations

extends HttpServerOperations
implements WebsocketInbound, WebsocketOutbound
Class Inheritance
All Implemented Interfaces
reactor.netty5.http.websocket.WebsocketOutbound, reactor.netty5.NettyOutbound, org.reactivestreams.Publisher, reactor.netty5.http.websocket.WebsocketInbound, reactor.netty5.NettyInbound
Imports
java.util.concurrent.atomic.AtomicIntegerFieldUpdater, io.netty5.buffer.Buffer, io.netty5.channel.Channel, .ChannelFutureListeners, .ChannelHandlerContext, io.netty5.handler.codec.http.DefaultFullHttpRequest, .EmptyLastHttpContent, .HttpHeaderNames, .FullHttpRequest, io.netty5.handler.codec.http.headers.HttpHeaders, io.netty5.handler.codec.http.websocketx.CloseWebSocketFrame, .PingWebSocketFrame, .PongWebSocketFrame, .WebSocketCloseStatus, .WebSocketServerHandshaker, .WebSocketServerHandshakerFactory, io.netty5.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler, io.netty5.util.concurrent.Future, .FutureListener, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, .Sinks, reactor.netty5.FutureMono, .NettyOutbound, .NettyPipeline, .ReactorNetty, reactor.netty5.http.HttpOperations, reactor.netty5.http.websocket.WebsocketInbound, .WebsocketOutbound, reactor.util.annotation.Nullable

Conversion between Netty types and Reactor types (HttpOperations
Authors
Stephane Maldini, Simon Baslé

Field Summary

Modifier and TypeField and Description
pack-priv static final AtomicIntegerFieldUpdater<WebsocketServerOperations>
pack-priv volatile int
pack-priv final WebSocketServerHandshaker
pack-priv final Future<Void>
pack-priv final Sinks.One<WebSocketCloseStatus>
pack-priv final boolean
Inherited from reactor.netty5.http.server.HttpServerOperations:
compressionPredicateconnectionInfoCONTINUEcookieHoldercurrentContextEVENT_STREAMformDecoderProviderlogmapHandlenettyRequestnettyResponseparamsResolverpathresponseHeadersschemetrailerHeadersConsumer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders
headers()

Implements reactor.netty5.http.websocket.WebsocketInbound.headers.

Returns the websocket remote headers sent during handshake
public boolean
isWebsocket()

Overrides reactor.netty5.http.server.HttpServerOperations.isWebsocket.

Implements reactor.netty5.http.HttpInfos.isWebsocket.

Returns true if websocket connection (upgraded)
protected void
onInboundCancel()

Overrides reactor.netty5.channel.ChannelOperations.onInboundCancel.

React on inbound cancel (receive() subscriber cancelled)
public void
protected void
onOutboundComplete()

Overrides reactor.netty5.http.server.HttpServerOperations.onOutboundComplete.

React on inbound/outbound completion (last packet)
protected void
onOutboundError(Throwable
the Throwable cause
err
)

Overrides reactor.netty5.http.server.HttpServerOperations.onOutboundError.

There is no need of invoking discard(), the inbound will be canceled on channel inactive event if there is no subscriber available
public Mono<WebSocketCloseStatus>
receiveCloseStatus()

Implements reactor.netty5.http.websocket.WebsocketInbound.receiveCloseStatus.

Receive the close status code and reason if sent by the remote peer, or empty if the connection completes otherwise.
public String
selectedSubprotocol()

Implements reactor.netty5.http.websocket.WebsocketInbound.selectedSubprotocol, reactor.netty5.http.websocket.WebsocketOutbound.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
)

Overrides reactor.netty5.http.HttpOperations.send.

Overrides default reactor.netty5.NettyOutbound.send.

Implements reactor.netty5.http.websocket.WebsocketOutbound.send.

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

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Prepare to send a close frame on subscribe then close the underlying channel
public Mono<Void>
sendClose(int
reserved bits used for protocol extensions
rsv
)

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Prepare to send a close frame on subscribe then close the underlying channel
public Mono<Void>
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
)

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Prepare to send a close frame on subscribe then close the underlying channel
public Mono<Void>
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
)

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Prepare to send a close frame on subscribe then close the underlying channel
pack-priv Mono<Void>
pack-priv void
pack-priv void
Inherited from reactor.netty5.http.server.HttpServerOperations:
addCookieaddHeaderafterMarkSentHeadersallCookiesbeforeMarkSentHeaderschunkedTransfercleanHandlerTerminatecompressioncookiescurrentContextfullPathheaderheadershostAddressisFormUrlencodedisHttp2isKeepAliveisMultipartkeepAlivemethodnewFullBodyMessageonHeadersSentonInboundCloseoutboundHttpMessageparamparamsparamsResolverreceiveFormreceiveFormreceiveFormInternalreceiveObjectremoteAddressrequestHeadersrequestsCounterresponseHeadersschemesendsendDecodingFailuressendFilesendHeaderssendNotFoundsendRedirectsendWebsocketssestatusstatustrailerHeadersuriversionwithConnectionwithWebsocketSupport

Field Detail

CLOSE_SENTback to summary
pack-priv static final AtomicIntegerFieldUpdater<WebsocketServerOperations> CLOSE_SENT
closeSentback to summary
pack-priv volatile int closeSent
handshakerback to summary
pack-priv final WebSocketServerHandshaker handshaker
handshakerResultback to summary
pack-priv final Future<Void> handshakerResult
onCloseStateback to summary
pack-priv final Sinks.One<WebSocketCloseStatus> onCloseState
proxyPingback to summary
pack-priv final boolean proxyPing

Constructor Detail

WebsocketServerOperationsback to summary
pack-priv WebsocketServerOperations(String wsUrl, WebsocketServerSpec websocketServerSpec, HttpServerOperations replaced)

Method Detail

headersback to summary
public HttpHeaders headers()

Implements reactor.netty5.http.websocket.WebsocketInbound.headers.

Doc from reactor.netty5.http.websocket.WebsocketInbound.headers.

Returns the websocket remote headers sent during handshake

Returns:HttpHeaders

the websocket remote headers sent during handshake

Annotations
@Override
isWebsocketback to summary
public boolean isWebsocket()

Overrides reactor.netty5.http.server.HttpServerOperations.isWebsocket.

Implements reactor.netty5.http.HttpInfos.isWebsocket.

Doc from reactor.netty5.http.HttpInfos.isWebsocket.

Returns true if websocket connection (upgraded)

Returns:boolean

true if websocket connection

Annotations
@Override
onInboundCancelback to summary
protected void onInboundCancel()

Overrides reactor.netty5.channel.ChannelOperations.onInboundCancel.

Doc from reactor.netty5.channel.ChannelOperations.onInboundCancel.

React on inbound cancel (receive() subscriber cancelled)

Annotations
@Override
onInboundNextback to summary
public void onInboundNext(ChannelHandlerContext ctx, Object frame)

Overrides reactor.netty5.http.server.HttpServerOperations.onInboundNext.

Doc from reactor.netty5.channel.ChannelOperations.onInboundNext.

React on inbound Channel#read

Parameters
ctx:ChannelHandlerContext

the context

frame:Object

the read payload

Annotations
@Override
onOutboundCompleteback to summary
protected void onOutboundComplete()

Overrides reactor.netty5.http.server.HttpServerOperations.onOutboundComplete.

Doc from reactor.netty5.channel.ChannelOperations.onOutboundComplete.

React on inbound/outbound completion (last packet)

Annotations
@Override
onOutboundErrorback to summary
protected void onOutboundError(Throwable err)

Overrides reactor.netty5.http.server.HttpServerOperations.onOutboundError.

Doc from reactor.netty5.http.server.HttpServerOperations.onOutboundError.

There is no need of invoking discard(), the inbound will be canceled on channel inactive event if there is no subscriber available

Parameters
err:Throwable

the Throwable cause

Annotations
@Override
receiveCloseStatusback to summary
public Mono<WebSocketCloseStatus> receiveCloseStatus()

Implements reactor.netty5.http.websocket.WebsocketInbound.receiveCloseStatus.

Doc from reactor.netty5.http.websocket.WebsocketInbound.receiveCloseStatus.

Receive the close status code and reason if sent by the remote peer, or empty if the connection completes otherwise.

Note

Some close status codes are designated for use in applications expecting a status code to indicate that the connection was closed etc. They are not meant to be set as a status code in a Close control frame as such these status codes cannot be used with reactor.netty5.http.websocket.WebsocketOutbound#sendClose* methods. Consider checking RFC 6455#section-7.4 for a complete list of the close status codes.

Annotations
@Override
@SuppressWarnings:unchecked
selectedSubprotocolback to summary
public String selectedSubprotocol()

Implements reactor.netty5.http.websocket.WebsocketInbound.selectedSubprotocol, reactor.netty5.http.websocket.WebsocketOutbound.selectedSubprotocol.

Doc from reactor.netty5.http.websocket.WebsocketInbound.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
@Override
@Nullable
sendback to summary
public NettyOutbound send(Publisher<? extends Buffer> dataStream)

Overrides reactor.netty5.http.HttpOperations.send.

Overrides default reactor.netty5.NettyOutbound.send.

Implements reactor.netty5.http.websocket.WebsocketOutbound.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()

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Doc from reactor.netty5.http.websocket.WebsocketOutbound.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

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

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Doc from reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

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

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

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Doc from reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

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

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

Implements reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

Doc from reactor.netty5.http.websocket.WebsocketOutbound.sendClose.

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

Annotations
@Override
sendCloseback to summary
pack-priv Mono<Void> sendClose(CloseWebSocketFrame frame)
sendCloseNowback to summary
pack-priv void sendCloseNow(CloseWebSocketFrame frame, FutureListener<Void> listener)
sendCloseNowback to summary
pack-priv void sendCloseNow(CloseWebSocketFrame frame, WebSocketCloseStatus closeStatus, FutureListener<Void> listener)