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)
ClientAioHandler
heartbeatPacket
in interface ClientAioHandler
public Packet decode(ByteBuffer buffer, int limit, int position, int readableLength, ChannelContext ctx) throws TioDecodeException
AioHandler
decode
in interface AioHandler
buffer
- 参与本次希望解码的ByteBufferlimit
- ByteBuffer的limitposition
- ByteBuffer的position,不一定是0哦readableLength
- ByteBuffer参与本次解码的有效数据(= limit - position)AioDecodeException
TioDecodeException
public ByteBuffer encode(Packet packet, TioConfig tioConfig, ChannelContext ctx)
AioHandler
encode
in interface AioHandler
public void handler(Packet packet, ChannelContext ctx) throws Exception
AioHandler
handler
in interface AioHandler
Exception
Copyright © 2021. All rights reserved.