public interface Session extends ClientSession, Closeable
| 限定符和类型 | 方法和说明 |
|---|---|
<T> T |
attr(String name)
获取属性
|
<T> Session |
attrDel(String name)
删除属性
|
boolean |
attrHas(String name)
是有属性
|
Map<String,Object> |
attrMap()
获取所有属性
|
<T> T |
attrOrDefault(String name,
T def)
获取属性或默认值
|
<T> Session |
attrPut(String name,
T value)
放置属性
|
Handshake |
handshake()
获取握手信息
|
boolean |
isClosing()
是否关闭中
|
boolean |
isValid()
是否有效
|
long |
liveTime()
最后活动时间
|
InetSocketAddress |
localAddress()
获取本地地址
|
default String |
name()
broker player name
|
String |
param(String name)
获取握手参数
|
String |
paramOrDefault(String name,
String def)
获取握手参数或默认值
|
String |
path()
获取握手路径
|
void |
pathNew(String pathNew)
设置握手新路径
|
void |
reconnect()
手动重连(一般是自动)
|
InetSocketAddress |
remoteAddress()
获取远程地址
|
void |
reply(Message from,
Entity entity)
答复
|
void |
replyEnd(Message from,
Entity entity)
答复并结束(即最后一次答复)
|
void |
sendAlarm(Message from,
String alarm)
发送告警
|
void |
sendPing()
手动发送 Ping(一般是自动)
|
String |
sessionId()
获取会话Id
|
close, closeStarting, preclose, send, sendAndRequest, sendAndRequest, sendAndSubscribe, sendAndSubscribeInetSocketAddress remoteAddress() throws IOException
IOExceptionInetSocketAddress localAddress() throws IOException
IOExceptionHandshake handshake()
default String name()
String path()
void pathNew(String pathNew)
boolean attrHas(String name)
name - 名字<T> T attr(String name)
name - 名字<T> T attrOrDefault(String name, T def)
name - 名字def - 默认值boolean isValid()
isValid 在接口中 ClientSessionboolean isClosing()
isClosing 在接口中 ClientSessionString sessionId()
sessionId 在接口中 ClientSessionlong liveTime()
void reconnect()
throws IOException
reconnect 在接口中 ClientSessionIOExceptionvoid sendPing()
throws IOException
IOExceptionvoid sendAlarm(Message from, String alarm) throws IOException
IOExceptionvoid reply(Message from, Entity entity) throws IOException
from - 来源消息entity - 实体IOExceptionvoid replyEnd(Message from, Entity entity) throws IOException
from - 来源消息entity - 实体IOExceptionCopyright © 2024. All rights reserved.