类 StandardWebSocketClient
- java.lang.Object
- org.springframework.web.reactive.socket.client.StandardWebSocketClient
- 所有已实现的接口:
WebSocketClient
- 直接已知子类:
TomcatWebSocketClient
public class StandardWebSocketClient extends Object implements WebSocketClient
WebSocketClient
implementation for use with the Java WebSocket API.- 从以下版本开始:
- 5.0
- 作者:
- Violeta Georgieva, Rossen Stoyanchev
- 另请参阅:
- https://www.jcp.org/en/jsr/detail?id=356
构造器概要
构造器 构造器 说明 StandardWebSocketClient()
Default constructor that callsContainerProvider.getWebSocketContainer()
to obtain a (new)WebSocketContainer
instance.StandardWebSocketClient(WebSocketContainer webSocketContainer)
Constructor accepting an existingWebSocketContainer
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected DataBufferFactory
bufferFactory()
protected StandardWebSocketSession
createWebSocketSession(Session session, HandshakeInfo info, reactor.core.publisher.MonoProcessor<Void> completion)
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.WebSocketContainer
getWebSocketContainer()
Return the configuredWebSocketContainer
to use.
构造器详细资料
StandardWebSocketClient
public StandardWebSocketClient()
Default constructor that callsContainerProvider.getWebSocketContainer()
to obtain a (new)WebSocketContainer
instance.
StandardWebSocketClient
public StandardWebSocketClient(WebSocketContainer webSocketContainer)
Constructor accepting an existingWebSocketContainer
instance.- 参数:
webSocketContainer
- a web socket container
方法详细资料
getWebSocketContainer
public WebSocketContainer getWebSocketContainer()
Return the configuredWebSocketContainer
to use.
execute
public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
从接口复制的说明:WebSocketClient
Execute 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)
从接口复制的说明:WebSocketClient
A 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.
createWebSocketSession
protected StandardWebSocketSession createWebSocketSession(Session session, HandshakeInfo info, reactor.core.publisher.MonoProcessor<Void> completion)
bufferFactory
protected DataBufferFactory bufferFactory()