public class StandardWebSocketClient extends AbstractWebSocketClient
logger
Constructor and Description |
---|
StandardWebSocketClient()
Default constructor that calls
ContainerProvider.getWebSocketContainer() to
obtain a WebSocketContainer instance. |
StandardWebSocketClient(javax.websocket.WebSocketContainer webSocketContainer)
Constructor that accepts a pre-configured
WebSocketContainer instance. |
Modifier and Type | Method and Description |
---|---|
protected ListenableFuture<WebSocketSession> |
doHandshakeInternal(WebSocketHandler webSocketHandler,
HttpHeaders headers,
URI uri,
List<String> protocols,
List<WebSocketExtension> extensions,
Map<String,Object> handshakeAttributes)
Perform the actual handshake to establish a connection to the server.
|
AsyncListenableTaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor . |
void |
setTaskExecutor(AsyncListenableTaskExecutor taskExecutor)
Set a
TaskExecutor to use to open the connection. |
doHandshake, doHandshake
public StandardWebSocketClient()
ContainerProvider.getWebSocketContainer()
to
obtain a WebSocketContainer
instance.public StandardWebSocketClient(javax.websocket.WebSocketContainer webSocketContainer)
WebSocketContainer
instance. If
using XML configuration see WebSocketContainerFactoryBean
. In Java
configuration use ContainerProvider.getWebSocketContainer()
to obtain
a container instance.public void setTaskExecutor(AsyncListenableTaskExecutor taskExecutor)
TaskExecutor
to use to open the connection.
By default SimpleAsyncTaskExecutor
is used.public AsyncListenableTaskExecutor getTaskExecutor()
TaskExecutor
.protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> protocols, List<WebSocketExtension> extensions, Map<String,Object> handshakeAttributes)
AbstractWebSocketClient
doHandshakeInternal
in class AbstractWebSocketClient
webSocketHandler
- the client-side handler for WebSocket messagesheaders
- HTTP headers to use for the handshake, with unwanted (forbidden)
headers filtered out, never null
uri
- the target URI for the handshake, never null
protocols
- requested sub-protocols, or an empty listextensions
- requested WebSocket extensions, or an empty listhandshakeAttributes
- attributes to make available via
WebSocketSession.getHandshakeAttributes()
; currently always an empty map.