Class ReactorNettyRequestUpgradeStrategy

java.lang.Object
org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy
All Implemented Interfaces:
RequestUpgradeStrategy

public class ReactorNettyRequestUpgradeStrategy extends Object implements RequestUpgradeStrategy
A webSocket RequestUpgradeStrategy for Reactor Netty.
Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • ReactorNettyRequestUpgradeStrategy

      public ReactorNettyRequestUpgradeStrategy()
      Create an instances with a default websocketServerSpec.Builder.
      Since:
      5.2.6
    • ReactorNettyRequestUpgradeStrategy

      public ReactorNettyRequestUpgradeStrategy(Supplier<reactor.netty.http.server.websocketServerSpec.Builder> builderSupplier)
      Create an instance with a pre-configured websocketServerSpec.Builder to use for webSocket upgrades.
      Since:
      5.2.6
  • Method Details

    • getwebsocketServerSpec

      public reactor.netty.http.server.websocketServerSpec getwebsocketServerSpec()
      Build an instance of 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.
      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 interface RequestUpgradeStrategy
      Parameters:
      exchange - the current exchange
      handler - 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.