Class ReactorNetty2RequestUpgradeStrategy
java.lang.Object
org.springframework.web.reactive.socket.server.upgrade.ReactorNetty2RequestUpgradeStrategy
- All Implemented Interfaces:
RequestUpgradeStrategy
A WebSocket
RequestUpgradeStrategy
for Reactor Netty for Netty 5.
This class is based on ReactorNettyRequestUpgradeStrategy
.
- Since:
- 6.0
- Author:
- Violeta Georgieva
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instances with a defaultWebsocketServerSpec.Builder
.ReactorNetty2RequestUpgradeStrategy
(Supplier<reactor.netty5.http.server.WebsocketServerSpec.Builder> builderSupplier) Create an instance with a pre-configuredWebsocketServerSpec.Builder
to use for WebSocket upgrades. -
Method Summary
Modifier and TypeMethodDescriptionreactor.netty5.http.server.WebsocketServerSpec
Build an instance ofWebsocketServerSpec
that reflects the current configuration.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.
-
Constructor Details
-
ReactorNetty2RequestUpgradeStrategy
public ReactorNetty2RequestUpgradeStrategy()Create an instances with a defaultWebsocketServerSpec.Builder
.- Since:
- 5.2.6
-
ReactorNetty2RequestUpgradeStrategy
public ReactorNetty2RequestUpgradeStrategy(Supplier<reactor.netty5.http.server.WebsocketServerSpec.Builder> builderSupplier) Create an instance with a pre-configuredWebsocketServerSpec.Builder
to use for WebSocket upgrades.- Since:
- 5.2.6
-
-
Method Details
-
getWebsocketServerSpec
public reactor.netty5.http.server.WebsocketServerSpec getWebsocketServerSpec()Build an instance ofWebsocketServerSpec
that reflects the current configuration. This can be used to check the configured parameters except for sub-protocols which depend on theWebSocketHandler
that is used for a given upgrade.- Since:
- 5.2.6
-
upgrade
public reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) Description copied from interface:RequestUpgradeStrategy
Upgrade to a WebSocket session and handle it with the given handler.- Specified by:
upgrade
in interfaceRequestUpgradeStrategy
- Parameters:
exchange
- the current exchangehandler
- handler for the WebSocket sessionsubProtocol
- the selected sub-protocol got the handlerhandshakeInfoFactory
- factory to create HandshakeInfo for the WebSocket session- Returns:
- completion
Mono<Void>
to indicate the outcome of the WebSocket session handling.
-