public interface TioListener
| Modifier and Type | Method and Description |
|---|---|
default void |
onAfterConnected(ChannelContext context,
boolean isConnected,
boolean isReconnect)
建链后触发本方法,注:建链不一定成功,需要关注参数isConnected
|
default void |
onAfterDecoded(ChannelContext context,
Packet packet,
int packetSize)
原方法名:onAfterDecoded
解码成功后触发本方法
|
default void |
onAfterHandled(ChannelContext context,
Packet packet,
long cost)
处理一个消息包后
|
default void |
onAfterReceivedBytes(ChannelContext context,
int receivedBytes)
接收到TCP层传过来的数据后
|
default void |
onAfterSent(ChannelContext context,
Packet packet,
boolean isSentSuccess)
消息包发送之后触发本方法
|
default void |
onBeforeClose(ChannelContext context,
Throwable throwable,
String remark,
boolean isRemove)
连接关闭前触发本方法
|
default void onAfterConnected(ChannelContext context, boolean isConnected, boolean isReconnect) throws Exception
context - ChannelContextisConnected - 是否连接成功,true:表示连接成功,false:表示连接失败isReconnect - 是否是重连, true: 表示这是重新连接,false: 表示这是第一次连接Exception - Exceptiondefault void onAfterDecoded(ChannelContext context, Packet packet, int packetSize) throws Exception
context - ChannelContextpacket - PacketpacketSize - packetSizeException - Exceptiondefault void onAfterReceivedBytes(ChannelContext context, int receivedBytes) throws Exception
context - ChannelContextreceivedBytes - 本次接收了多少字节Exception - Exceptiondefault void onAfterSent(ChannelContext context, Packet packet, boolean isSentSuccess) throws Exception
context - ChannelContextpacket - PacketisSentSuccess - true:发送成功,false:发送失败Exception - Exceptiondefault void onAfterHandled(ChannelContext context, Packet packet, long cost) throws Exception
context - ChannelContextpacket - Packetcost - 本次处理消息耗时,单位:毫秒Exception - Exceptiondefault void onBeforeClose(ChannelContext context, Throwable throwable, String remark, boolean isRemove) throws Exception
context - the ChannelContextthrowable - the throwable 有可能为空remark - the remark 有可能为空isRemove - isRemoveException - ExceptionCopyright © 2024. All rights reserved.