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

JettyWebSocketClient

open class JettyWebSocketClient : AbstractWebSocketClient, Lifecycle

Initiates WebSocket requests to a WebSocket server programmatically through the Jetty WebSocket API.

As of 4.1 this class implements Lifecycle rather than org.springframework.context.SmartLifecycle. Use org.springframework.web.socket.client.WebSocketConnectionManager instead to auto-start a WebSocket connection.

Author
Rossen Stoyanchev

Since
4.0

Constructors

<init>

JettyWebSocketClient()

Default constructor that creates an instance of org.eclipse.jetty.websocket.client.WebSocketClient.

JettyWebSocketClient(client: WebSocketClient)

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

Functions

doHandshake

open fun doHandshake(webSocketHandler: WebSocketHandler, uriTemplate: String, vararg uriVars: Any): ListenableFuture<WebSocketSession>

doHandshakeInternal

open fun doHandshakeInternal(wsHandler: WebSocketHandler, headers: HttpHeaders, uri: URI, protocols: MutableList<String>, extensions: MutableList<WebSocketExtension>, attributes: MutableMap<String, Any>): ListenableFuture<WebSocketSession>

getTaskExecutor

open fun getTaskExecutor(): AsyncListenableTaskExecutor

Return the configured TaskExecutor.

isRunning

open fun isRunning(): Boolean

setTaskExecutor

open fun setTaskExecutor(taskExecutor: AsyncListenableTaskExecutor): Unit

Set an AsyncListenableTaskExecutor to use when opening connections. If this property is set to null, calls to any of the doHandshake methods will block until the connection is established.

By default an instance of SimpleAsyncTaskExecutor is used.

start

open fun start(): Unit

stop

open fun stop(): Unit