public class ReactorNettyRequestUpgradeStrategy extends Object implements RequestUpgradeStrategy
RequestUpgradeStrategy
for use with Reactor Netty.Constructor and Description |
---|
ReactorNettyRequestUpgradeStrategy()
Create an instances with a default
WebsocketServerSpec.Builder . |
ReactorNettyRequestUpgradeStrategy(Supplier<reactor.netty.http.server.WebsocketServerSpec.Builder> builderSupplier)
Create an instance with a pre-configured
WebsocketServerSpec.Builder
to use for WebSocket upgrades. |
Modifier and Type | Method and Description |
---|---|
boolean |
getHandlePing()
Deprecated.
as of 5.2.6 in favor of
getWebsocketServerSpec() |
int |
getMaxFramePayloadLength()
Deprecated.
as of 5.2.6 in favor of
getWebsocketServerSpec() |
reactor.netty.http.server.WebsocketServerSpec |
getWebsocketServerSpec()
Build an instance of
WebsocketServerSpec that reflects the current
configuration. |
void |
setHandlePing(boolean handlePing)
Deprecated.
as of 5.2.6 in favor of providing a supplier of
WebsocketServerSpec.Builder with a
constructor argument |
void |
setMaxFramePayloadLength(Integer maxFramePayloadLength)
Deprecated.
as of 5.2.6 in favor of providing a supplier of
WebsocketServerSpec.Builder with a
constructor argument |
reactor.core.publisher.Mono<Void> |
upgrade(ServerWebExchange exchange,
WebSocketHandler handler,
String subProtocol,
Supplier<HandshakeInfo> handshakeInfoFactory)
Upgrade to a WebSocket session and handle it with the given handler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
upgrade
public ReactorNettyRequestUpgradeStrategy()
WebsocketServerSpec.Builder
.public ReactorNettyRequestUpgradeStrategy(Supplier<reactor.netty.http.server.WebsocketServerSpec.Builder> builderSupplier)
WebsocketServerSpec.Builder
to use for WebSocket upgrades.public reactor.netty.http.server.WebsocketServerSpec getWebsocketServerSpec()
WebsocketServerSpec
that reflects the current
configuration. This can be used to check the configured parameters except
for sub-protocols which depend on the WebSocketHandler
that is used
for a given upgrade.@Deprecated public void setMaxFramePayloadLength(Integer maxFramePayloadLength)
WebsocketServerSpec.Builder
with a
constructor argumentCorresponds to the argument with the same name in the constructor of
WebSocketServerHandshakerFactory
in Netty.
By default set to 65536 (64K).
maxFramePayloadLength
- the max length for frames.@Deprecated public int getMaxFramePayloadLength()
getWebsocketServerSpec()
@Deprecated public void setHandlePing(boolean handlePing)
WebsocketServerSpec.Builder
with a
constructor argumentWebSocketHandler
given to the upgrade method. By default, Reactor
Netty automatically replies with pong frames in response to pings. This is
useful in a proxy for allowing ping and pong frames through.
By default this is set to false
in which case ping frames are
handled automatically by Reactor Netty. If set to true
, ping
frames will be passed through to the WebSocketHandler
.
handlePing
- whether to let Ping frames through for handling@Deprecated public boolean getHandlePing()
getWebsocketServerSpec()
setHandlePing(boolean)
.public reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)
RequestUpgradeStrategy
upgrade
in interface RequestUpgradeStrategy
exchange
- the current exchangehandler
- handler for the WebSocket sessionsubProtocol
- the selected sub-protocol got the handlerhandshakeInfoFactory
- factory to create HandshakeInfo for the WebSocket sessionMono<Void>
to indicate the outcome of the
WebSocket session handling.