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,
io.undertow.connector.ByteBufferPool byteBufferPool,
java.util.function.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
Alternate constructor providing additional control over the
WebSocketClient.ConnectionBuilder for each WebSocket connection. |
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.
|
io.undertow.connector.ByteBufferPool |
getByteBufferPool() |
java.util.function.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> |
getConnectionBuilderConsumer()
Return the configured
Consumer<ConnectionBuilder . |
int |
getPoolBufferSize()
Deprecated.
as of 5.0.8 this method is deprecated in favor
of using
getByteBufferPool() |
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) . |
void |
setPoolBufferSize(int poolBufferSize)
Deprecated.
as of 5.0.8 this method is deprecated in favor
of
setByteBufferPool(io.undertow.connector.ByteBufferPool) |
afterHandshake, beforeHandshake
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, 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 UndertowWebSocketClient(XnioWorker worker, io.undertow.connector.ByteBufferPool byteBufferPool, 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
'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 is used.
public io.undertow.connector.ByteBufferPool getByteBufferPool()
ByteBufferPool
currently used
for newly created WebSocket sessions by this clientpublic java.util.function.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()
Consumer<ConnectionBuilder
.@Deprecated public void setPoolBufferSize(int poolBufferSize)
setByteBufferPool(io.undertow.connector.ByteBufferPool)
ByteBufferPool
to pass to
WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI)
.
By default the buffer size is set to .
@Deprecated public int getPoolBufferSize()
getByteBufferPool()
ByteBufferPool
.public reactor.core.publisher.Mono<java.lang.Void> execute(java.net.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<java.lang.Void> execute(java.net.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 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 ByteBufferPool
and
then passes it to the consumer
provided at construction time.