Top Description Methods
org.springframework.web.socket.client

public Interface WebSocketClient

Known Direct Implementers
org.springframework.web.socket.sockjs.client.SockJsClient, org.springframework.web.socket.client.AbstractWebSocketClient
Imports
java.net.URI, java.util.concurrent.CompletableFuture, org.springframework.lang.Nullable, org.springframework.web.socket.WebSocketHandler, .WebSocketHttpHeaders, .WebSocketSession

Contract for initiating a WebSocket request. As an alternative considering using the declarative style WebSocketConnectionManager that starts a WebSocket connection to a pre-configured URI when the application starts.
Author
Rossen Stoyanchev
Since
4.0
See Also
WebSocketConnectionManager

Method Summary

Modifier and TypeMethod and Description
public default ListenableFuture<WebSocketSession>

Returns:

a future that completes when the session is available
doHandshake
(WebSocketHandler
the session handler
webSocketHandler
,
String
the url template
uriTemplate
,
Object...
the variables to expand the template
uriVariables
)
Deprecated since 6.0. as of 6.0, in favor of execute(WebSocketHandler, String, Object...)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

public default ListenableFuture<WebSocketSession>

Returns:

a future that completes when the session is available
doHandshake
(WebSocketHandler
the session handler
webSocketHandler
,
WebSocketHttpHeaders headers, URI
the url
uri
)
Deprecated since 6.0. as of 6.0, in favor of execute(WebSocketHandler, WebSocketHttpHeaders, URI)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

public CompletableFuture<WebSocketSession>

Returns:

a future that completes when the session is available
execute
(WebSocketHandler
the session handler
webSocketHandler
,
String
the url template
uriTemplate
,
Object...
the variables to expand the template
uriVariables
)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

public CompletableFuture<WebSocketSession>

Returns:

a future that completes when the session is available
execute
(WebSocketHandler
the session handler
webSocketHandler
,
WebSocketHttpHeaders headers, URI
the url
uri
)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

Method Detail

doHandshakeback to summary
public default ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables)

Deprecated

since 6.0.

as of 6.0, in favor of execute(WebSocketHandler, String, Object...)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

Parameters
webSocketHandler:WebSocketHandler

the session handler

uriTemplate:String

the url template

uriVariables:Object[]

the variables to expand the template

Returns:ListenableFuture<WebSocketSession>

a future that completes when the session is available

Annotations
@Deprecated
since:6.0
doHandshakeback to summary
public default ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri)

Deprecated

since 6.0.

as of 6.0, in favor of execute(WebSocketHandler, WebSocketHttpHeaders, URI)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

Parameters
webSocketHandler:WebSocketHandler

the session handler

uri:URI

the url

Returns:ListenableFuture<WebSocketSession>

a future that completes when the session is available

Annotations
@Deprecated
since:6.0
executeback to summary
public CompletableFuture<WebSocketSession> execute(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables)

Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.

Parameters
webSocketHandler:WebSocketHandler

the session handler

uriTemplate:String

the url template

uriVariables:Object[]

the variables to expand the template

Returns:CompletableFuture<WebSocketSession>

a future that completes when the session is available

Since
6.0
executeback to summary
public CompletableFuture<WebSocketSession> 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.

Parameters
webSocketHandler:WebSocketHandler

the session handler

uri:URI

the url

Returns:CompletableFuture<WebSocketSession>

a future that completes when the session is available

Since
6.0