spring-framework / org.springframework.web.reactive.socket.client / JettyWebSocketClient

JettyWebSocketClient

open class JettyWebSocketClient : WebSocketClientSupport, WebSocketClient, Lifecycle

A WebSocketClient implementation for use with Jetty org.eclipse.jetty.websocket.client.WebSocketClient.

Note: the Jetty WebSocketClient requires lifecycle management and must be started and stopped. This is automatically managed when this class is declared as a Spring bean and created with the default constructor. See constructor notes for more details.

Author
Violeta Georgieva

Author
Rossen Stoyanchev

Since
5.0

Constructors

<init>

JettyWebSocketClient()

Default constructor that creates and manages an instance of a Jetty org.eclipse.jetty.websocket.client.WebSocketClient. The instance can be obtained with #getJettyClient() for further configuration.

Note: When this constructor is used Lifecycle methods of this class are delegated to the Jetty WebSocketClient.

JettyWebSocketClient(jettyClient: WebSocketClient)

Constructor that accepts an existing instance of a Jetty org.eclipse.jetty.websocket.client.WebSocketClient.

Note: Use of this constructor implies the Jetty WebSocketClient is externally managed and hence Lifecycle methods of this class are not delegated to it.

Functions

execute

open fun execute(url: URI, handler: WebSocketHandler): Mono<Void>
open fun execute(url: URI, headers: HttpHeaders, handler: WebSocketHandler): Mono<Void>

getJettyClient

open fun getJettyClient(): WebSocketClient

Return the underlying Jetty WebSocketClient.

isRunning

open fun isRunning(): Boolean

start

open fun start(): Unit

stop

open fun stop(): Unit