LISTENER - 监听器类型CODEC - 客户端编解码器接口类型public interface IClient<LISTENER extends IListener<?>,CODEC extends INioCodec> extends Closeable
| Modifier and Type | Method and Description |
|---|---|
IClientCfg |
clientCfg()
获取客户端配置对象
|
void |
connect()
连接远程服务端
|
void |
initialize(IClientCfg clientCfg,
LISTENER listener,
CODEC codec,
IReconnectService reconnectService,
IHeartbeatService<?> heartbeatService)
初始化客户端服务
|
boolean |
isClosing()
是否正在关闭
|
boolean |
isConnected()
是否已连接
|
long |
lastTouchTime()
获取最后更新会话状态的时间(毫秒)
|
<T extends LISTENER> |
listener()
获取监听器
|
void |
reconnect()
重连远程服务端
|
void |
send(Object message)
向远程服务发送消息
|
void |
touch()
更新会话活动状态
|
void initialize(IClientCfg clientCfg, LISTENER listener, CODEC codec, IReconnectService reconnectService, IHeartbeatService<?> heartbeatService)
clientCfg - 客户端配置listener - 事件适配器codec - 解码器reconnectService - 断线重连服务heartbeatService - 链路维护(心跳)服务void connect()
throws IOException
IOException - 可能产生的异常void reconnect()
throws IOException
IOException - 可能产生的异常boolean isConnected()
boolean isClosing()
IClientCfg clientCfg()
<T extends LISTENER> T listener()
T - 监听器类型void send(Object message) throws IOException
message - 消息对象IOException - 可能产生的异常void touch()
long lastTouchTime()
Copyright © 2022. All rights reserved.