diff --git a/wg-basic/websocket.md b/wg-basic/websocket.md index 74fe23d..543bf55 100644 --- a/wg-basic/websocket.md +++ b/wg-basic/websocket.md @@ -2,7 +2,7 @@ title: 即时消息 description: 即时消息模块的使用 published: true -date: 2021-09-14T07:08:58.741Z +date: 2021-09-14T07:16:02.666Z tags: wg-basic editor: markdown dateCreated: 2021-09-14T06:25:26.887Z @@ -49,15 +49,19 @@ websocket: 消息格式为 **JSONObject** 字符串 具体内容如下表 -| 名称 | 说明 | +| 名称 | 说明 | 类型 | 是否可空 | | :-: | :-: | -| type | 消息类型编码 | -| isSystem | 是否是系统消息 | -| from | 发送人的 **userId** | -| to | 接收人的 **userId** 或 **userId 列表**。userId 列表为 **英文逗号** 分割的字符串 | -| body | 消息主体,主体的具体格式会根据 **消息编码(type)** 的变化而变化 +| id | 消息ID,唯一 | String | 否 | +| type | 消息类型编码 | Integer | 否 | +| isSystem | 是否是系统消息 | Boolean | 否 | +| from | 发送人的 **userId**,如果是系统消息则为:**SYSTEM** | String | 否 | +| to | 接收人的 **userId** 或 **userId 列表**。userId 列表为 **英文逗号** 分割的字符串 | String | 否 | +| body | 消息主体,主体的具体格式会根据 **消息编码(type)** 的变化而变化 | String | 否 | +| timestamp | 消息时间戳 millisecond | Long | 是 | -## 2. 请求类型编码 +注:from与to可以相同 + +## 2. 消息编码 | 编码 | 说明 | 主体格式 | | :-: | :-: | :-: | @@ -66,6 +70,6 @@ websocket: | 9001 | 消息发送状态 | StatusBody 的 JSONObject 字符串 | | 9101 | 消息接受状态 | StatusBody 的 JSONObject 字符串 | -## 3. 响应类型 +## 3. 主体 + -## 4. 主体