spring-framework / org.springframework.web.socket.client.standard / StandardWebSocketClient

StandardWebSocketClient

open class StandardWebSocketClient : AbstractWebSocketClient

A WebSocketClient based on standard Java WebSocket API.

Author
Rossen Stoyanchev

Since
4.0

Constructors

<init>

StandardWebSocketClient()

Default constructor that calls ContainerProvider.getWebSocketContainer() to obtain a (new) WebSocketContainer instance. Also see constructor accepting existing WebSocketContainer instance.

StandardWebSocketClient(webSocketContainer: WebSocketContainer)

Constructor accepting an existing WebSocketContainer instance.

For XML configuration, see WebSocketContainerFactoryBean. For Java configuration, use ContainerProvider.getWebSocketContainer() to obtain the WebSocketContainer instance.

Functions

getTaskExecutor

open fun getTaskExecutor(): AsyncListenableTaskExecutor

Return the configured TaskExecutor.

getUserProperties

open fun getUserProperties(): MutableMap<String, Any>

The configured user properties.

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.

setUserProperties

open fun setUserProperties(userProperties: MutableMap<String, Any>): Unit

The standard Java WebSocket API allows passing "user properties" to the server via userProperties. Use this property to configure one or more properties to be passed on every handshake.