public class StandardWebSocketClient extends AbstractWebSocketClient
logger| Constructor and Description |
|---|
StandardWebSocketClient()
Default constructor that calls
ContainerProvider.getWebSocketContainer()
to obtain a (new) WebSocketContainer instance. |
StandardWebSocketClient(javax.websocket.WebSocketContainer webSocketContainer)
Constructor accepting an existing
WebSocketContainer instance. |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.util.concurrent.ListenableFuture<WebSocketSession> |
doHandshakeInternal(WebSocketHandler webSocketHandler,
org.springframework.http.HttpHeaders headers,
URI uri,
List<String> protocols,
List<WebSocketExtension> extensions,
Map<String,Object> attributes)
Perform the actual handshake to establish a connection to the server.
|
org.springframework.core.task.AsyncListenableTaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor. |
void |
setTaskExecutor(org.springframework.core.task.AsyncListenableTaskExecutor taskExecutor)
Set an
AsyncListenableTaskExecutor to use when opening connections. |
doHandshake, doHandshakepublic StandardWebSocketClient()
ContainerProvider.getWebSocketContainer()
to obtain a (new) WebSocketContainer instance. Also see constructor
accepting existing WebSocketContainer instance.public StandardWebSocketClient(javax.websocket.WebSocketContainer webSocketContainer)
WebSocketContainer instance.
For XML configuration see WebSocketContainerFactoryBean. For Java
configuration use ContainerProvider.getWebSocketContainer() to obtain
the WebSocketContainer instance.
public void setTaskExecutor(org.springframework.core.task.AsyncListenableTaskExecutor taskExecutor)
AsyncListenableTaskExecutor to use when opening connections.
If this property is not configured, calls to any of the
doHandshake methods will block until the connection is established.
public org.springframework.core.task.AsyncListenableTaskExecutor getTaskExecutor()
TaskExecutor.protected org.springframework.util.concurrent.ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler, org.springframework.http.HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)
AbstractWebSocketClientdoHandshakeInternal in class AbstractWebSocketClientwebSocketHandler - the client-side handler for WebSocket messagesheaders - HTTP headers to use for the handshake, with unwanted (forbidden)
headers filtered out, never nulluri - the target URI for the handshake, never nullprotocols - requested sub-protocols, or an empty listextensions - requested WebSocket extensions, or an empty listattributes - attributes to associate with the WebSocketSession, i.e. via
WebSocketSession.getAttributes(); currently always an empty map.