Files
obsidian_vault/技术研究/OpenIM/OpenIM源码分析之三---消息机制.md
T
2025-12-27 11:44:50 +08:00

42 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
##### OpenIM五种系统消息类型
* TextMessagePing/Pone Message
* BinaryMessageChat Message)
* CloseMessage(客户端关闭连接)
* PingMessage
* PongMessage
##### BinaryMessageReq/Resp
```golang
type Req struct {
ReqIdentifier int32 `json:"reqIdentifier" validate:"required"`
Token string `json:"token"`
SendID string `json:"sendID" validate:"required"`
OperationID string `json:"operationID" validate:"required"`
MsgIncr string `json:"msgIncr" validate:"required"`
Data []byte `json:"data"`
}
type Resp struct {
ReqIdentifier int32 `json:"reqIdentifier"`
MsgIncr string `json:"msgIncr"`
OperationID string `json:"operationID"`
ErrCode int `json:"errCode"`
ErrMsg string `json:"errMsg"`
Data []byte `json:"data"`
}
```
##### ReqIdentifier
```golang
WSGetNewestSeq = 1001
WSPullMsgBySeqList = 1002
WSSendMsg = 1003 // 一般聊天消息
WSSendSignalMsg = 1004
WSPullMsg = 1005
WSGetConvMaxReadSeq = 1006
WsPullConvLastMessage = 1007
WSPushMsg = 2001
WSKickOnlineMsg = 2002
WsLogoutMsg = 2003
WsSetBackgroundStatus = 2004
WsSubUserOnlineStatus = 2005
WSDataError = 3001
```