mini_im

module
v0.0.0-...-3c2c7ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: Apache-2.0

README

mini_im 通信流程

  1. 客户端->注册发信服务连接请求->服务端

  2. 客户端<-返回生成的客户端请求id+房间号<-服务端

  3. 客户端->注册收信服务连接请求->服务端

  4. 客户端<->并发收信发信<->服务端

  5. 任意一段程序停止,断开连接

报文组成(总报文=操作码+分报文)

总报文=[操作码 1 byte]+[正文]

注册收信报文=[客户端id 3 byte]+[房间号 2 byte]

注册发信报文=[房间号 2 byte]

消息响应报文=[消息id 1 byte]+[房间号 2 byte]+[消息来源客户端id 3 byte]

消息通知报文=[消息数量 1 byte]

消息发送报文=[正文]

操作码

  • MSG_SYN:建立新连接,搭配注册系报文
  • MSG_ACK:建立连接成功过后的后续通信,搭配消息系报文
  • MSG_CTR:控制命令,用于更改连接信息,例如更换房间等操作或者错误提示信息,自定义报文和解析

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL