# FlourChat-Server-Document **Repository Path**: Jamesmc/FlourChat-Server-Document ## Basic Information - **Project Name**: FlourChat-Server-Document - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: v0 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-03-13 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # FlourChat-Server-Document This document is only in Chinese. # 连接方式 创建一个websocket长连接到服务器。 # 数据包格式 (Version 0x00) ## Header部分,占8字节 一个完整的header看起来是这样子的: ``` 00 00 01 00 00 00 00 00 ``` - 第一个字节:版本号:永远为0x00 - 第二个字节:连接类型:永远为0x00 - 第三个字节:包ID:根据不同的功能来定义 - 第四个字节:发送者类型:永远为0x00 - 第五个字节和第六个字节:一个Short代表包体长度 - 第七个字节和第八个字节:一个Short永远为0 ## 包体部分 ### String的识别 一个完整的String识别串是这样子的: ``` 00 00 00 04 ``` - 第一个字节和第二个字节为0x00 - 第三个字节和第四个字节为一个Short,表示String的长度 ### int16(short)的识别 一个完整的int16识别串是这样子的: ``` 01 00 ``` - 第一个字节为0x01 - 第二个字节为0x00 ### int32的识别 一个完整的int32识别串是这样子的: ``` 01 01 ``` - 第一个字节为0x01 - 第二个字节为0x01 ### int64的识别 一个完整的int64识别串是这样子的: ``` 01 02 ``` - 第一个字节为0x01 - 第二个字节为0x02 # 数据包 一个数据包包括Header和包体两部分