Class AbstractWebSocketClient
- java.lang.Object
- org.springframework.web.socket.client.AbstractWebSocketClient
- All Implemented Interfaces:
WebSocketClient
- Direct Known Subclasses:
JettyWebSocketClient,StandardWebSocketClient
public abstract class AbstractWebSocketClient extends Object implements WebSocketClient
Abstract base class forWebSocketClientimplementations.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description AbstractWebSocketClient()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertUri(URI uri)ListenableFuture<WebSocketSession>doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars)ListenableFuture<WebSocketSession>doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)protected abstract ListenableFuture<WebSocketSession>doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> subProtocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)Perform the actual handshake to establish a connection to the server.
Constructor Detail
AbstractWebSocketClient
public AbstractWebSocketClient()
Method Detail
doHandshake
public ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars)
- Specified by:
doHandshakein interfaceWebSocketClient
doHandshake
public final ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)
- Specified by:
doHandshakein interfaceWebSocketClient
doHandshakeInternal
protected abstract ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> subProtocols, List<WebSocketExtension> extensions, Map<String,Object> attributes)
Perform the actual handshake to establish a connection to the server.- Parameters:
webSocketHandler- the client-side handler for WebSocket messagesheaders- HTTP headers to use for the handshake, with unwanted (forbidden) headers filtered out, nevernulluri- the target URI for the handshake, nevernullsubProtocols- requested sub-protocols, or an empty listextensions- requested WebSocket extensions, or an empty listattributes- attributes to associate with the WebSocketSession, i.e. viaWebSocketSession.getAttributes(); currently always an empty map.- Returns:
- the established WebSocket session wrapped in a ListenableFuture.