/connected

长连接服务

Primary LanguageGoMIT LicenseMIT

connected

长连接服务

参考zinx接口定义实现的长连接服务

传输协议

参考腾讯Mars终端交互协议

0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        headLength = 0                         |
+---------------------------------------------------------------+
|                      clientVersion = 0                        |
+---------------------------------------------------------------+
|                          cmdId = 0                            |
+---------------------------------------------------------------+
|                           seq = 0                             |
+---------------------------------------------------------------+
|                         bodyLen = 0                           |
+---------------------------------------------------------------+
|                                                               |
|                          options                              |
|                                                               |
+---------------------------------------------------------------+
|                                                               |
+                            body                               +
|                                                               |

+---------------------------------------------------------------+
字段名称 字段说明 字段类型 字节数
headLength 表示消息头字节数,值为固定头20个字节+自定义头的字节数 int 4
clientVersion 客户端版本 int 4
cmdId 消息类型 int 4
seq 消息序号 int 4
bodyLen 消息体字节数 int 4
options 自定义头 byte[] headLength-20
body 消息提 byte[] bodyLen