类 UndertowWebSocketClient
- java.lang.Object
- org.springframework.web.reactive.socket.client.UndertowWebSocketClient
- 所有已实现的接口:
WebSocketClient
public class UndertowWebSocketClient extends Object implements WebSocketClient
Undertow based implementation ofWebSocketClient.- 从以下版本开始:
- 5.0
- 作者:
- Violeta Georgieva, Rossen Stoyanchev
构造器概要
构造器 构造器 说明 UndertowWebSocketClient(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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected io.undertow.websockets.client.WebSocketClient.ConnectionBuildercreateConnectionBuilder(URI url)Create 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.ByteBufferPoolgetByteBufferPool()Return theByteBufferPoolcurrently used for newly created WebSocket sessions by this client.Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder>getConnectionBuilderConsumer()Return the configuredConsumer<ConnectionBuilder>.XnioWorkergetXnioWorker()Return the configuredXnioWorker.voidsetByteBufferPool(io.undertow.connector.ByteBufferPool byteBufferPool)Set theByteBufferPoolto pass toWebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).
构造器详细资料
UndertowWebSocketClient
public UndertowWebSocketClient(XnioWorker worker)
Constructor with theXnioWorkerto pass toWebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).- 参数:
worker- the Xnio worker
UndertowWebSocketClient
public UndertowWebSocketClient(XnioWorker worker, Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
Alternate constructor providing additional control over theWebSocketClient.ConnectionBuilderfor each WebSocket connection.- 参数:
worker- the Xnio worker to use to createConnectionBuilder'sbuilderConsumer- a consumer to configureConnectionBuilder's
UndertowWebSocketClient
public 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.- 参数:
worker- the Xnio worker to use to createConnectionBuilder'sbyteBufferPool- the ByteBufferPool to use to createConnectionBuilder'sbuilderConsumer- a consumer to configureConnectionBuilder's- 从以下版本开始:
- 5.0.8
方法详细资料
getXnioWorker
public XnioWorker getXnioWorker()
Return the configuredXnioWorker.
setByteBufferPool
public 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.- 从以下版本开始:
- 5.0.8
- 另请参阅:
DEFAULT_POOL_BUFFER_SIZE
getByteBufferPool
public io.undertow.connector.ByteBufferPool getByteBufferPool()
Return theByteBufferPoolcurrently used for newly created WebSocket sessions by this client.- 返回:
- the byte buffer pool
- 从以下版本开始:
- 5.0.8
getConnectionBuilderConsumer
public Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()
Return the configuredConsumer<ConnectionBuilder>.
execute
public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
从接口复制的说明:WebSocketClientExecute a handshake request to the given url and handle the resulting WebSocket session with the given handler.- 指定者:
execute在接口中WebSocketClient- 参数:
url- the handshake urlhandler- the handler of the WebSocket session- 返回:
- completion
Mono<Void>to indicate the outcome of the WebSocket session handling.
execute
public reactor.core.publisher.Mono<Void> execute(URI url, HttpHeaders headers, WebSocketHandler handler)
从接口复制的说明:WebSocketClientA variant ofWebSocketClient.execute(URI, WebSocketHandler)with custom headers.- 指定者:
execute在接口中WebSocketClient- 参数:
url- the handshake urlheaders- custom headers for the handshake requesthandler- the handler of the WebSocket session- 返回:
- completion
Mono<Void>to indicate the outcome of the WebSocket session handling.
createConnectionBuilder
protected 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.