public abstract class AbstractWebSocketClient extends Object implements WebSocketClient, WebSocketClientListener
| 限定符和类型 | 字段和说明 |
|---|---|
protected ChannelHandlerContext |
ctx |
protected EventLoopGroup |
eventLoopGroup |
private AtomicInteger |
idleConnectTimeout |
protected org.slf4j.Logger |
log |
protected String |
uri |
| 构造器和说明 |
|---|
AbstractWebSocketClient(String uri,
EventLoopGroup eventLoopGroup,
ChannelHandlerContext ctx)
Constructs a WebSocketClient instance and sets it to the connect to the specified URI.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
addAndGetIdleConnectTimeout(int idleConnectTimeout)
Adds Idle Connect Timeout and get it.
|
void |
onMessage(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame) |
void |
onMessage(io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame) |
void |
onPing(io.netty.handler.codec.http.websocketx.PingWebSocketFrame frame) |
void |
onPong(io.netty.handler.codec.http.websocketx.PongWebSocketFrame frame) |
void |
resetIdleConnectTimeout()
Resets idle connect timeout.
|
void |
send(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame)
Send Binary data (plain bytes) to the other end.
|
void |
send(io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame)
Sends text to the connected websocket server.
|
void |
sendPing(io.netty.handler.codec.http.websocketx.PingWebSocketFrame frame)
Send a ping to the other end.
|
void |
sendPong(io.netty.handler.codec.http.websocketx.PongWebSocketFrame frame)
Send a ping to the other end.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, connect, getStateonCloseprotected final org.slf4j.Logger log
protected String uri
protected ChannelHandlerContext ctx
protected EventLoopGroup eventLoopGroup
private volatile AtomicInteger idleConnectTimeout
public AbstractWebSocketClient(String uri, EventLoopGroup eventLoopGroup, ChannelHandlerContext ctx) throws URISyntaxException
uri - the server URI to connect toeventLoopGroup - eventLoopGroupctx - handler contextURISyntaxException - URISyntaxExceptionpublic int addAndGetIdleConnectTimeout(int idleConnectTimeout)
WebSocketClientaddAndGetIdleConnectTimeout 在接口中 WebSocketClientidleConnectTimeout - idle connect timeoutpublic void resetIdleConnectTimeout()
WebSocketClientresetIdleConnectTimeout 在接口中 WebSocketClientpublic void sendPing(io.netty.handler.codec.http.websocketx.PingWebSocketFrame frame)
WebSocketClientsendPing 在接口中 WebSocketClientframe - PingWebSocketFramepublic void sendPong(io.netty.handler.codec.http.websocketx.PongWebSocketFrame frame)
WebSocketClientsendPong 在接口中 WebSocketClientframe - PingWebSocketFramepublic void send(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame)
WebSocketClientsend 在接口中 WebSocketClientframe - PingWebSocketFramepublic void send(io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame)
WebSocketClientsend 在接口中 WebSocketClientframe - TextWebSocketFrame text The string which will be transmitted.public void onPing(io.netty.handler.codec.http.websocketx.PingWebSocketFrame frame)
onPing 在接口中 WebSocketClientListenerpublic void onPong(io.netty.handler.codec.http.websocketx.PongWebSocketFrame frame)
onPong 在接口中 WebSocketClientListenerpublic void onMessage(io.netty.handler.codec.http.websocketx.TextWebSocketFrame frame)
onMessage 在接口中 WebSocketClientListenerpublic void onMessage(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame)
onMessage 在接口中 WebSocketClientListenerCopyright © 2022 Zodiac. All rights reserved.