public interface EventListener<T>
| 限定符和类型 | 方法和说明 |
|---|---|
void |
exceptionCaught(TcpServerConnectionContext<T> ctx,
Throwable t)
异常处理
|
void |
onConnect(TcpServerConnectionContext<T> ctx)
客户端与服务端建立连接
|
void |
onDisconnect(TcpServerConnectionContext<T> ctx,
CloseReason reason)
客户端与服务端断开连接
|
void |
onHeartbeatTimeout(TcpServerConnectionContext<T> ctx,
java.time.LocalDateTime lastOccurTime,
int count)
* 客户端不活跃(超过了设定的心跳超时时间)
|
void onConnect(TcpServerConnectionContext<T> ctx)
ctx - Contextvoid onDisconnect(TcpServerConnectionContext<T> ctx, CloseReason reason)
ctx - 上下文reason - 关闭连接原因void onHeartbeatTimeout(TcpServerConnectionContext<T> ctx, java.time.LocalDateTime lastOccurTime, int count)
ctx - 上下文lastOccurTime - 上次发生时间,如果是第一次,则为 nullcount - 连续发生次数,如果有数据进来就会被重置为0开始void exceptionCaught(TcpServerConnectionContext<T> ctx, Throwable t)
ctx - 上下文t - ThrowableCopyright © 2023. All rights reserved.