public class UndertowWebSocketClient extends WebSocketClientSupport implements WebSocketClient
WebSocketClient.logger| 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,
java.util.function.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(java.net.URI url)
Create a
WebSocketClient.ConnectionBuilder for the given URI. |
reactor.core.publisher.Mono<java.lang.Void> |
execute(java.net.URI url,
HttpHeaders headers,
WebSocketHandler handler)
A variant of
WebSocketClient.execute(URI, WebSocketHandler) with custom headers. |
reactor.core.publisher.Mono<java.lang.Void> |
execute(java.net.URI url,
WebSocketHandler handler)
Execute a handshake request to the given url and handle the resulting
WebSocket session with the given handler.
|
java.util.function.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> |
getConnectionBuilderConsumer()
Return the configured
Consumer<ConnectionBuilder. |
int |
getPoolBufferSize()
Return the size for Undertow's WebSocketClient
ByteBufferPool. |
XnioWorker |
getXnioWorker()
Return the configured
XnioWorker. |
void |
setPoolBufferSize(int poolBufferSize)
Configure the size of the
ByteBufferPool to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI). |
afterHandshake, beforeHandshakepublic 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, java.util.function.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 XnioWorker getXnioWorker()
XnioWorker.public java.util.function.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()
Consumer<ConnectionBuilder.public void setPoolBufferSize(int poolBufferSize)
ByteBufferPool to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).
By default the buffer size is set to 8192.
public int getPoolBufferSize()
ByteBufferPool.public reactor.core.publisher.Mono<java.lang.Void> execute(java.net.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<java.lang.Void> execute(java.net.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(java.net.URI url)
WebSocketClient.ConnectionBuilder for the given URI.
The default implementation creates a builder with the configured
XnioWorker and getPoolBufferSize() and
then passes it to the consumer
provided at construction time.