org.springframework.web.reactive.socket.client

Class ReactorNettyWebSocketClient

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


    public class ReactorNettyWebSocketClient
    extends java.lang.Object
    implements WebSocketClient
    WebSocketClient implementation for use with Reactor Netty.
    Since:
    5.0
    Author:
    Rossen Stoyanchev
    • Constructor Detail

      • ReactorNettyWebSocketClient

        public ReactorNettyWebSocketClient()
        Default constructor.
      • ReactorNettyWebSocketClient

        public ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
        Constructor that accepts an existing HttpClient builder.
        Since:
        5.1
    • Method Detail

      • getHttpClient

        public reactor.netty.http.client.HttpClient getHttpClient()
        Return the configured HttpClient.
      • execute

        public reactor.core.publisher.Mono<java.lang.Void> execute(java.net.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<java.lang.Void> execute(java.net.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.