Class UndertowWebSocketClient
java.lang.Object
org.springframework.web.reactive.socket.client.UndertowWebSocketClient
- All Implemented Interfaces:
- WebSocketClient
Undertow based implementation of 
WebSocketClient.- Since:
- 5.0
- Author:
- Violeta Georgieva, Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionUndertowWebSocketClient(XnioWorker worker) Constructor with theXnioWorkerto pass toWebSocketClient.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 theWebSocketClient.ConnectionBuilderfor each WebSocket connection.UndertowWebSocketClient(XnioWorker worker, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer) Alternate constructor providing additional control over theWebSocketClient.ConnectionBuilderfor each WebSocket connection.
- 
Method SummaryModifier and TypeMethodDescriptionprotected io.undertow.websockets.client.WebSocketClient.ConnectionBuilderCreate aWebSocketClient.ConnectionBuilderfor the given URI.reactor.core.publisher.Mono<Void>execute(URI url, HttpHeaders headers, WebSocketHandler handler) A variant ofWebSocketClient.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.ByteBufferPoolReturn theByteBufferPoolcurrently used for newly created WebSocket sessions by this client.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder>Return the configuredConsumer<ConnectionBuilder>.Return the configuredXnioWorker.voidsetByteBufferPool(io.undertow.connector.ByteBufferPool byteBufferPool) Set theByteBufferPoolto pass toWebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).
- 
Constructor Details- 
UndertowWebSocketClientConstructor with theXnioWorkerto pass toWebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).- Parameters:
- worker- the Xnio worker
 
- 
UndertowWebSocketClientpublic UndertowWebSocketClient(XnioWorker worker, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer) Alternate constructor providing additional control over theWebSocketClient.ConnectionBuilderfor each WebSocket connection.- Parameters:
- worker- the Xnio worker to use to create- ConnectionBuilder's
- builderConsumer- a consumer to configure- ConnectionBuilder's
 
- 
UndertowWebSocketClientpublic UndertowWebSocketClient(XnioWorker worker, io.undertow.connector.ByteBufferPool byteBufferPool, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer) Alternate constructor providing additional control over theWebSocketClient.ConnectionBuilderfor each WebSocket connection.- Parameters:
- worker- the Xnio worker to use to create- ConnectionBuilder's
- byteBufferPool- the ByteBufferPool to use to create- ConnectionBuilder's
- builderConsumer- a consumer to configure- ConnectionBuilder's
- Since:
- 5.0.8
 
 
- 
- 
Method Details- 
getXnioWorkerReturn the configuredXnioWorker.
- 
setByteBufferPoolpublic void setByteBufferPool(io.undertow.connector.ByteBufferPool byteBufferPool) Set theByteBufferPoolto pass toWebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).By default an indirect DefaultByteBufferPoolwith a buffer size of 8192 is used.- Since:
- 5.0.8
- See Also:
- 
- DEFAULT_POOL_BUFFER_SIZE
 
 
- 
getByteBufferPoolpublic io.undertow.connector.ByteBufferPool getByteBufferPool()Return theByteBufferPoolcurrently used for newly created WebSocket sessions by this client.- Returns:
- the byte buffer pool
- Since:
- 5.0.8
 
- 
getConnectionBuilderConsumerpublic Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()Return the configuredConsumer<ConnectionBuilder>.
- 
executeDescription copied from interface:WebSocketClientExecute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- Specified by:
- executein interface- WebSocketClient
- Parameters:
- url- the handshake url
- handler- the handler of the WebSocket session
- Returns:
- completion Mono<Void>to indicate the outcome of the WebSocket session handling.
 
- 
executepublic reactor.core.publisher.Mono<Void> execute(URI url, HttpHeaders headers, WebSocketHandler handler) Description copied from interface:WebSocketClientA variant ofWebSocketClient.execute(URI, WebSocketHandler)with custom headers.- Specified by:
- executein interface- WebSocketClient
- Parameters:
- url- the handshake url
- headers- custom headers for the handshake request
- handler- the handler of the WebSocket session
- Returns:
- completion Mono<Void>to indicate the outcome of the WebSocket session handling.
 
- 
createConnectionBuilderprotected io.undertow.websockets.client.WebSocketClient.ConnectionBuilder createConnectionBuilder(URI url) Create aWebSocketClient.ConnectionBuilderfor the given URI.The default implementation creates a builder with the configured XnioWorkerandByteBufferPooland then passes it to theconsumerprovided at construction time.
 
-