| | |
| | | package com.ard.tianyu.netty.command;// RegisterMessage.java |
| | | |
| | | import io.netty.buffer.ByteBuf; |
| | | |
| | | /** |
| | | * 注册命令 |
| | | * |
| | | * @author 刘苏义 |
| | | * @date 2024/10/22 16:36 |
| | | */ |
| | | public class RegisterCommand extends BaseCommand { |
| | | private int userId; |
| | | private byte[] accessToken; |
| | |
| | | |
| | | @Override |
| | | public void encode(ByteBuf out) { |
| | | out.writeShort(getDataHeader()); // 写入帧头 |
| | | out.writeShort(getDataHeader()); // 写入数据头 |
| | | out.writeShort(getDataLength()); // 写入数据长度 |
| | | out.writeByte(getCmdCode()); // 写入指令编号 |
| | | out.writeByte(getCmdCode()); // 写入命令码 |
| | | out.writeInt(userId); // 写入用户编号 |
| | | out.writeBytes(accessToken); // 写入访问令牌 |
| | | } |