public class WsClientAioHander extends Object implements ClientAioHandler
| Constructor and Description |
|---|
WsClientAioHander() |
| Modifier and Type | Method and Description |
|---|---|
Packet |
decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext ctx)
根据ByteBuffer解码成业务需要的Packet对象.
|
ByteBuffer |
encode(Packet packet,
TioConfig tioConfig,
ChannelContext ctx)
编码
|
void |
handler(Packet packet,
ChannelContext ctx)
处理消息包
|
Packet |
heartbeatPacket(ChannelContext ctx)
创建心跳包
|
public Packet heartbeatPacket(ChannelContext ctx)
ClientAioHandlerheartbeatPacket in interface ClientAioHandlerpublic Packet decode(ByteBuffer buffer, int limit, int position, int readableLength, ChannelContext ctx) throws TioDecodeException
AioHandlerdecode in interface AioHandlerbuffer - 参与本次希望解码的ByteBufferlimit - ByteBuffer的limitposition - ByteBuffer的position,不一定是0哦readableLength - ByteBuffer参与本次解码的有效数据(= limit - position)AioDecodeExceptionTioDecodeExceptionpublic ByteBuffer encode(Packet packet, TioConfig tioConfig, ChannelContext ctx)
AioHandlerencode in interface AioHandlerpublic void handler(Packet packet, ChannelContext ctx) throws Exception
AioHandlerhandler in interface AioHandlerExceptionCopyright © 2021. All rights reserved.