Interface RequestUpgradeStrategy
- All Known Implementing Classes:
JettyRequestUpgradeStrategy
,ReactorNetty2RequestUpgradeStrategy
,ReactorNettyRequestUpgradeStrategy
,StandardWebSocketUpgradeStrategy
,TomcatRequestUpgradeStrategy
,UndertowRequestUpgradeStrategy
public interface RequestUpgradeStrategy
A strategy for upgrading an HTTP request to a WebSocket session depending
on the underlying network runtime.
Typically there is one such strategy for every ServerHttpRequest
and ServerHttpResponse
type except in the case of Servlet containers
for which the standard Java WebSocket API JSR-356 does not define a way to
upgrade a request so a custom strategy is needed for every Servlet container.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
upgrade
(ServerWebExchange exchange, WebSocketHandler webSocketHandler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) Upgrade to a WebSocket session and handle it with the given handler.
-
Method Details
-
upgrade
reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) Upgrade to a WebSocket session and handle it with the given handler.- Parameters:
exchange
- the current exchangewebSocketHandler
- 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. - Since:
- 5.1
-