类 ReactorNettyWebSocketClient
- java.lang.Object
- org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient
- 所有已实现的接口:
WebSocketClient
public class ReactorNettyWebSocketClient extends Object implements WebSocketClient
WebSocketClient
implementation for use with Reactor Netty.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ReactorNettyWebSocketClient()
Default constructor.ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
Constructor that accepts an existingHttpClient
builder.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<Void>
execute(URI url, HttpHeaders requestHeaders, 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.boolean
getHandlePing()
Return the configuredsetHandlePing(boolean)
.reactor.netty.http.client.HttpClient
getHttpClient()
Return the configuredHttpClient
.int
getMaxFramePayloadLength()
Return the configuredmaxFramePayloadLength
.void
setHandlePing(boolean handlePing)
Configure whether to let ping frames through to be handled by theWebSocketHandler
given to the execute method.void
setMaxFramePayloadLength(int maxFramePayloadLength)
Configure the maximum allowable frame payload length.
构造器详细资料
ReactorNettyWebSocketClient
public ReactorNettyWebSocketClient()
Default constructor.
ReactorNettyWebSocketClient
public ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
Constructor that accepts an existingHttpClient
builder.- 从以下版本开始:
- 5.1
方法详细资料
getHttpClient
public reactor.netty.http.client.HttpClient getHttpClient()
Return the configuredHttpClient
.
setMaxFramePayloadLength
public void setMaxFramePayloadLength(int maxFramePayloadLength)
Configure the maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.Corresponds to the argument with the same name in the constructor of
WebSocketServerHandshakerFactory
in Netty.By default set to 65536 (64K).
- 参数:
maxFramePayloadLength
- the max length for frames.- 从以下版本开始:
- 5.2
getMaxFramePayloadLength
public int getMaxFramePayloadLength()
Return the configuredmaxFramePayloadLength
.- 从以下版本开始:
- 5.2
setHandlePing
public void setHandlePing(boolean handlePing)
Configure whether to let ping frames through to be handled by theWebSocketHandler
given to the execute method. By default, Reactor Netty automatically replies with pong frames in response to pings. This is useful in a proxy for allowing ping and pong frames through.By default this is set to
false
in which case ping frames are handled automatically by Reactor Netty. If set totrue
, ping frames will be passed through to theWebSocketHandler
.- 参数:
handlePing
- whether to let Ping frames through for handling- 从以下版本开始:
- 5.2.4
getHandlePing
public boolean getHandlePing()
Return the configuredsetHandlePing(boolean)
.- 从以下版本开始:
- 5.2.4
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 requestHeaders, WebSocketHandler handler)
从接口复制的说明:WebSocketClient
A variant ofWebSocketClient.execute(URI, WebSocketHandler)
with custom headers.- 指定者:
execute
在接口中WebSocketClient
- 参数:
url
- the handshake urlrequestHeaders
- custom headers for the handshake requesthandler
- the handler of the WebSocket session- 返回:
- completion
Mono<Void>
to indicate the outcome of the WebSocket session handling.