Class ReactorNetty2WebSocketClient

java.lang.Object
org.springframework.web.reactive.socket.client.ReactorNetty2WebSocketClient
All Implemented Interfaces:
WebSocketClient

public class ReactorNetty2WebSocketClient extends Object implements WebSocketClient
WebSocketClient implementation for use with Reactor Netty for Netty 5.

This class is based on ReactorNettyWebSocketClient.

Since:
6.0
Author:
Violeta Georgieva
  • Constructor Details

    • ReactorNetty2WebSocketClient

      public ReactorNetty2WebSocketClient()
      Default constructor.
    • ReactorNetty2WebSocketClient

      public ReactorNetty2WebSocketClient(reactor.netty5.http.client.HttpClient httpClient)
      Constructor that accepts an existing HttpClient builder with a default WebsocketClientSpec.Builder.
      Since:
      5.1
    • ReactorNetty2WebSocketClient

      public ReactorNetty2WebSocketClient(reactor.netty5.http.client.HttpClient httpClient, Supplier<reactor.netty5.http.client.WebsocketClientSpec.Builder> builderSupplier)
      Constructor that accepts an existing HttpClient builder and a pre-configured WebsocketClientSpec.Builder.
  • Method Details

    • getHttpClient

      public reactor.netty5.http.client.HttpClient getHttpClient()
      Return the configured HttpClient.
    • getWebsocketClientSpec

      public reactor.netty5.http.client.WebsocketClientSpec getWebsocketClientSpec()
      Build an instance of WebsocketClientSpec 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.
    • execute

      public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
      Description copied from interface: WebSocketClient
      Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.
      Specified by:
      execute in interface WebSocketClient
      Parameters:
      url - the handshake url
      handler - the handler of the WebSocket session
      Returns:
      completion Mono<Void> to indicate the outcome of the WebSocket session handling.
    • execute

      public reactor.core.publisher.Mono<Void> execute(URI url, HttpHeaders requestHeaders, WebSocketHandler handler)
      Description copied from interface: WebSocketClient
      A variant of WebSocketClient.execute(URI, WebSocketHandler) with custom headers.
      Specified by:
      execute in interface WebSocketClient
      Parameters:
      url - the handshake url
      requestHeaders - custom headers for the handshake request
      handler - the handler of the WebSocket session
      Returns:
      completion Mono<Void> to indicate the outcome of the WebSocket session handling.