Class AbstractWebSocketClient
java.lang.Object
org.springframework.web.socket.client.AbstractWebSocketClient
- All Implemented Interfaces:
- WebSocketClient
- Direct Known Subclasses:
- JettyWebSocketClient,- StandardWebSocketClient
Abstract base class for 
WebSocketClient implementations.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidprotected ListenableFuture<WebSocketSession>doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> subProtocols, List<WebSocketExtension> extensions, Map<String, Object> attributes) Deprecated.execute(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars) Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.execute(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri) Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.protected abstract CompletableFuture<WebSocketSession>executeInternal(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.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.client.WebSocketClientdoHandshake, doHandshake
- 
Field Details- 
logger
 
- 
- 
Constructor Details- 
AbstractWebSocketClientpublic AbstractWebSocketClient()
 
- 
- 
Method Details- 
executepublic CompletableFuture<WebSocketSession> execute(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars) Description copied from interface:WebSocketClientExecute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Specified by:
- executein interface- WebSocketClient
- Parameters:
- webSocketHandler- the session handler
- uriTemplate- the url template
- uriVars- the variables to expand the template
- Returns:
- a future that completes when the session is available
 
- 
executepublic final CompletableFuture<WebSocketSession> execute(WebSocketHandler webSocketHandler, @Nullable WebSocketHttpHeaders headers, URI uri) Description copied from interface:WebSocketClientExecute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Specified by:
- executein interface- WebSocketClient
- Parameters:
- webSocketHandler- the session handler
- uri- the url
- Returns:
- a future that completes when the session is available
 
- 
assertUri
- 
doHandshakeInternal@Deprecated(since="6.0") protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler, HttpHeaders headers, URI uri, List<String> subProtocols, List<WebSocketExtension> extensions, Map<String, Object> attributes) Deprecated.as of 6.0, in favor ofexecuteInternal(WebSocketHandler, HttpHeaders, URI, List, List, Map)Perform the actual handshake to establish a connection to the server.- Parameters:
- webSocketHandler- the client-side handler for WebSocket messages
- headers- the HTTP headers to use for the handshake, with unwanted (forbidden) headers filtered out (never- null)
- uri- the target URI for the handshake (never- null)
- subProtocols- requested sub-protocols, or an empty list
- extensions- requested WebSocket extensions, or an empty list
- attributes- the attributes to associate with the WebSocketSession, i.e. via- WebSocketSession.getAttributes(); currently always an empty map.
- Returns:
- the established WebSocket session wrapped in a ListenableFuture.
 
- 
executeInternalprotected abstract CompletableFuture<WebSocketSession> executeInternal(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 messages
- headers- the HTTP headers to use for the handshake, with unwanted (forbidden) headers filtered out (never- null)
- uri- the target URI for the handshake (never- null)
- subProtocols- requested sub-protocols, or an empty list
- extensions- requested WebSocket extensions, or an empty list
- attributes- the attributes to associate with the WebSocketSession, i.e. via- WebSocketSession.getAttributes(); currently always an empty map
- Returns:
- the established WebSocket session wrapped in a CompletableFuture.
 
 
- 
executeInternal(WebSocketHandler, HttpHeaders, URI, List, List, Map)