org.springframework.web.socket.client

## 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 for `WebSocketClient` implementations.

Since:
  4.0
Author:
  Rossen Stoyanchev

### Field Summary

Fields
`protected Log` `logger`

### Constructor Summary

Constructors
Constructor and Description
`AbstractWebSocketClient()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected void` `assertUri(URI uri)`
`org.springframework.util.concurrent.ListenableFuture<WebSocketSession>` `doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVars)`
`org.springframework.util.concurrent.ListenableFuture<WebSocketSession>` `doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)`
`protected abstract org.springframework.util.concurrent.ListenableFuture<WebSocketSession>` `doHandshakeInternal(WebSocketHandler webSocketHandler, org.springframework.http.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.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### logger

    protected final Log logger

### Constructor Detail

#### AbstractWebSocketClient

    public AbstractWebSocketClient()

### Method Detail

#### doHandshake

    public org.springframework.util.concurrent.ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler,
                                                                                              String uriTemplate,
                                                                                              Object... uriVars)

Specified by:
  `doHandshake` in interface `WebSocketClient`

#### doHandshake

    public final org.springframework.util.concurrent.ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler,
                                                                                                    @Nullable
                                                                                                    WebSocketHttpHeaders headers,
                                                                                                    URI uri)

Specified by:
  `doHandshake` in interface `WebSocketClient`

#### assertUri

    protected void assertUri(URI uri)

#### doHandshakeInternal

    protected abstract org.springframework.util.concurrent.ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler,
                                                                                                                  org.springframework.http.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 ListenableFuture.