public interface Channel
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close(int code)
关闭(1协议关,2用户关)
|
<T> T |
getAttachment(String name)
获取附件
|
Config |
getConfig()
获取配置
|
HandshakeInternal |
getHandshake()
获取握手信息
|
long |
getLiveTime()
最后活动时间
|
InetSocketAddress |
getLocalAddress()
获取本地地址
|
InetSocketAddress |
getRemoteAddress()
获取远程地址
|
Session |
getSession()
获取会话
|
int |
isClosed()
是否已关闭
|
boolean |
isClosing()
是否正在关闭
|
boolean |
isValid()
是否有效
|
void |
onError(Throwable error)
出错时
|
void |
putAttachment(String name,
Object val)
放置附件
|
void |
reconnect()
手动重连(一般是自动)
|
void |
retrieve(Frame frame,
StreamInternal stream)
接收(接收答复帧)
|
void |
send(Frame frame,
StreamInternal stream)
发送
|
void |
sendAlarm(Message from,
String alarm)
发送告警
|
void |
sendClose(int code)
发送 Close
|
void |
sendConnack()
发送连接确认(握手)
|
void |
sendConnect(String url,
Map<String,String> metaMap)
发送连接(握手)
|
void |
sendPing()
发送 Ping(心跳)
|
void |
sendPong()
发送 Pong(心跳)
|
void |
setHandshake(HandshakeInternal handshake)
设置握手信息
|
<T> T getAttachment(String name)
boolean isValid()
boolean isClosing()
int isClosed()
void close(int code)
long getLiveTime()
Config getConfig()
void setHandshake(HandshakeInternal handshake)
handshake - 握手信息HandshakeInternal getHandshake()
InetSocketAddress getRemoteAddress() throws IOException
IOExceptionInetSocketAddress getLocalAddress() throws IOException
IOExceptionvoid sendConnect(String url, Map<String,String> metaMap) throws IOException
url - 连接地址metaMap - 元信息IOExceptionvoid sendConnack()
throws IOException
IOExceptionvoid sendPing()
throws IOException
IOExceptionvoid sendPong()
throws IOException
IOExceptionvoid sendClose(int code)
throws IOException
code - 关闭代码IOExceptionvoid sendAlarm(Message from, String alarm) throws IOException
IOExceptionvoid send(Frame frame, StreamInternal stream) throws IOException
frame - 帧stream - 流(没有则为 null)IOExceptionvoid retrieve(Frame frame, StreamInternal stream)
frame - 帧stream - 流void reconnect()
throws IOException
IOExceptionvoid onError(Throwable error)
Session getSession()
Copyright © 2024. All rights reserved.