Interface RequestUpgradeStrategy

All Known Implementing Classes:
JettyCoreRequestUpgradeStrategy, JettyRequestUpgradeStrategy, ReactorNetty2RequestUpgradeStrategy, ReactorNettyRequestUpgradeStrategy, StandardWebSocketUpgradeStrategy, 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 Jakarta 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
See Also:
  • 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 exchange
      webSocketHandler - handler for the WebSocket session
      subProtocol - the selected sub-protocol got the handler
      handshakeInfoFactory - factory to create HandshakeInfo for the WebSocket session
      Returns:
      completion Mono<Void> to indicate the outcome of the WebSocket session handling.
      Since:
      5.1