Interface WebSocketClient
- All Known Implementing Classes:
AbstractWebSocketClient
,JettyWebSocketClient
,SockJsClient
,StandardWebSocketClient
public interface WebSocketClient
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.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ListenableFuture<WebSocketSession>
doHandshake
(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables) Deprecated.default ListenableFuture<WebSocketSession>
doHandshake
(WebSocketHandler webSocketHandler, WebSocketHttpHeaders headers, URI uri) Deprecated.as of 6.0, in favor ofexecute(WebSocketHandler, WebSocketHttpHeaders, URI)
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.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.
-
Method Details
-
doHandshake
@Deprecated(since="6.0") default ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, String uriTemplate, Object... uriVariables) Deprecated.as of 6.0, in favor ofexecute(WebSocketHandler, String, Object...)
Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Parameters:
webSocketHandler
- the session handleruriTemplate
- the url templateuriVariables
- the variables to expand the template- Returns:
- a future that completes when the session is available
-
execute
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
- the session handleruriTemplate
- the url templateuriVariables
- the variables to expand the template- Returns:
- a future that completes when the session is available
- Since:
- 6.0
-
doHandshake
@Deprecated(since="6.0") default ListenableFuture<WebSocketSession> doHandshake(WebSocketHandler webSocketHandler, @Nullable WebSocketHttpHeaders headers, URI uri) Deprecated.as of 6.0, in favor ofexecute(WebSocketHandler, WebSocketHttpHeaders, URI)
Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Parameters:
webSocketHandler
- the session handleruri
- the url- Returns:
- a future that completes when the session is available
-
execute
CompletableFuture<WebSocketSession> execute(WebSocketHandler webSocketHandler, @Nullable WebSocketHttpHeaders headers, URI uri) Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Parameters:
webSocketHandler
- the session handleruri
- the url- Returns:
- a future that completes when the session is available
- Since:
- 6.0
-
execute(WebSocketHandler, String, Object...)