42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
Markdown
##### OpenIM五种系统消息类型
|
||
* TextMessage(Ping/Pone Message)
|
||
* BinaryMessage(Chat Message)
|
||
* CloseMessage(客户端关闭连接)
|
||
* PingMessage
|
||
* PongMessage
|
||
##### BinaryMessage(Req/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
|
||
``` |