public interface ClientSession extends Closeable
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
关闭(发送关闭指令,并关闭连接)
|
default void |
closeStarting()
已过时。
2.4
|
boolean |
isClosing()
是否正在关闭中
|
boolean |
isValid()
是否有效
|
void |
preclose()
预关闭(发送预关闭指令,通知对端不要再主动发消息过来了)
|
void |
reconnect()
手动重连(一般是自动)
|
SendStream |
send(String event,
Entity entity)
发送
|
default RequestStream |
sendAndRequest(String event,
Entity entity)
发送并请求
|
RequestStream |
sendAndRequest(String event,
Entity entity,
long timeout)
发送并请求
|
default SubscribeStream |
sendAndSubscribe(String event,
Entity entity)
发送并订阅(答复结束之前,不限答复次数)
|
SubscribeStream |
sendAndSubscribe(String event,
Entity entity,
long timeout)
发送并订阅(答复结束之前,不限答复次数)
|
String |
sessionId()
获取会话Id
|
boolean isValid()
boolean isClosing()
String sessionId()
SendStream send(String event, Entity entity) throws IOException
event - 事件entity - 实体IOExceptiondefault RequestStream sendAndRequest(String event, Entity entity) throws IOException
event - 事件entity - 实体IOExceptionRequestStream sendAndRequest(String event, Entity entity, long timeout) throws IOException
event - 事件entity - 实体timeout - 超时(单位:毫秒)IOExceptiondefault SubscribeStream sendAndSubscribe(String event, Entity entity) throws IOException
event - 事件entity - 实体IOExceptionSubscribeStream sendAndSubscribe(String event, Entity entity, long timeout) throws IOException
event - 事件entity - 实体timeout - 超时(单位:毫秒)IOException@Deprecated default void closeStarting() throws IOException
IOExceptionvoid preclose()
throws IOException
IOExceptionvoid close()
throws IOException
close 在接口中 AutoCloseableclose 在接口中 CloseableIOExceptionvoid reconnect()
throws IOException
IOExceptionCopyright © 2024. All rights reserved.