public class UndertowWebSocketClient extends Object implements WebSocketClient
WebSocketClient.| Constructor and Description |
|---|
UndertowWebSocketClient(XnioWorker worker)
Constructor with the
XnioWorker to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI). |
UndertowWebSocketClient(XnioWorker worker,
io.undertow.connector.ByteBufferPool byteBufferPool,
Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
Alternate constructor providing additional control over the
WebSocketClient.ConnectionBuilder for each WebSocket connection. |
UndertowWebSocketClient(XnioWorker worker,
Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
Alternate constructor providing additional control over the
WebSocketClient.ConnectionBuilder for each WebSocket connection. |
| Modifier and Type | Method and Description |
|---|---|
protected io.undertow.websockets.client.WebSocketClient.ConnectionBuilder |
createConnectionBuilder(URI url)
Create a
WebSocketClient.ConnectionBuilder for the given URI. |
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.
|
io.undertow.connector.ByteBufferPool |
getByteBufferPool()
Return the
ByteBufferPool currently used
for newly created WebSocket sessions by this client. |
Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> |
getConnectionBuilderConsumer()
Return the configured
Consumer<ConnectionBuilder>. |
XnioWorker |
getXnioWorker()
Return the configured
XnioWorker. |
void |
setByteBufferPool(io.undertow.connector.ByteBufferPool byteBufferPool)
Set the
ByteBufferPool to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI). |
public UndertowWebSocketClient(XnioWorker worker)
XnioWorker to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).worker - the Xnio workerpublic UndertowWebSocketClient(XnioWorker worker, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
WebSocketClient.ConnectionBuilder for each WebSocket connection.worker - the Xnio worker to use to create ConnectionBuilder'sbuilderConsumer - a consumer to configure ConnectionBuilder'spublic UndertowWebSocketClient(XnioWorker worker, io.undertow.connector.ByteBufferPool byteBufferPool, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
WebSocketClient.ConnectionBuilder for each WebSocket connection.worker - the Xnio worker to use to create ConnectionBuilder'sbyteBufferPool - the ByteBufferPool to use to create ConnectionBuilder'sbuilderConsumer - a consumer to configure ConnectionBuilder'spublic XnioWorker getXnioWorker()
XnioWorker.public void setByteBufferPool(io.undertow.connector.ByteBufferPool byteBufferPool)
ByteBufferPool to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).
By default an indirect DefaultByteBufferPool
with a buffer size of 8192 is used.
DEFAULT_POOL_BUFFER_SIZEpublic io.undertow.connector.ByteBufferPool getByteBufferPool()
ByteBufferPool currently used
for newly created WebSocket sessions by this client.public Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()
Consumer<ConnectionBuilder>.public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
WebSocketClientexecute in interface WebSocketClienturl - 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)
WebSocketClientWebSocketClient.execute(URI, WebSocketHandler) with custom headers.execute in interface WebSocketClienturl - 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 io.undertow.websockets.client.WebSocketClient.ConnectionBuilder createConnectionBuilder(URI url)
WebSocketClient.ConnectionBuilder for the given URI.
The default implementation creates a builder with the configured
XnioWorker and ByteBufferPool and
then passes it to the consumer
provided at construction time.