public class StandardWebSocketClient extends Object implements WebSocketClient
WebSocketClient
implementation for use with the Java WebSocket API.Constructor and Description |
---|
StandardWebSocketClient()
Default constructor that calls
ContainerProvider.getWebSocketContainer() to obtain a (new)
WebSocketContainer instance. |
StandardWebSocketClient(WebSocketContainer webSocketContainer)
Constructor accepting an existing
WebSocketContainer instance. |
Modifier and Type | Method and Description |
---|---|
protected DataBufferFactory |
bufferFactory() |
protected StandardWebSocketSession |
createWebSocketSession(Session session,
HandshakeInfo info,
reactor.core.publisher.MonoProcessor<Void> completion) |
reactor.core.publisher.Mono<Void> |
execute(URI url,
HttpHeaders headers,
WebSocketHandler handler)
A variant of
WebSocketClient.execute(URI, WebSocketHandler) with custom headers. |
reactor.core.publisher.Mono<Void> |
execute(URI url,
WebSocketHandler handler)
Execute a handshake request to the given url and handle the resulting
WebSocket session with the given handler.
|
WebSocketContainer |
getWebSocketContainer()
Return the configured
WebSocketContainer to use. |
public StandardWebSocketClient()
ContainerProvider.getWebSocketContainer()
to obtain a (new)
WebSocketContainer
instance.public StandardWebSocketClient(WebSocketContainer webSocketContainer)
WebSocketContainer
instance.webSocketContainer
- a web socket containerpublic WebSocketContainer getWebSocketContainer()
WebSocketContainer
to use.public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
WebSocketClient
execute
in interface WebSocketClient
url
- the handshake urlhandler
- the handler of the WebSocket sessionMono<Void>
to indicate the outcome of the
WebSocket session handling.public reactor.core.publisher.Mono<Void> execute(URI url, HttpHeaders headers, WebSocketHandler handler)
WebSocketClient
WebSocketClient.execute(URI, WebSocketHandler)
with custom headers.execute
in interface WebSocketClient
url
- the handshake urlheaders
- custom headers for the handshake requesthandler
- the handler of the WebSocket sessionMono<Void>
to indicate the outcome of the
WebSocket session handling.protected StandardWebSocketSession createWebSocketSession(Session session, HandshakeInfo info, reactor.core.publisher.MonoProcessor<Void> completion)
protected DataBufferFactory bufferFactory()