Skip to content

Commit 3461be5

Browse files
committed
Update: /api/wss/chat-ws-go
1 parent 816b08a commit 3461be5

1 file changed

Lines changed: 126 additions & 0 deletions

File tree

src/api/wss/chat-ws-go.jwzhd.com.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,129 @@ message heartbeat_ack_info {
6666
}
6767
}
6868
```
69+
70+
## 推送消息
71+
72+
返回数据:
73+
```ProtoBuf
74+
info {
75+
seq: "1234567abcd" // 请求表示码
76+
cmd: "push_message" // 推送消息
77+
}
78+
79+
data {
80+
cmd: "type.googleapis.com/proto.PushMessage" // 操作类型?
81+
msg {
82+
msg_id: "abcdef" // 消息ID
83+
sender {
84+
chat_id: "7357777" // 发送者ID
85+
chat_type: 1 // 发送者类型,1-用户 3-机器人
86+
name: "测试" // 发送者名称
87+
avatar_url: "https://chat-img.jwznb.com/...." // 头像URL
88+
tag_old: "测试成员" // 标签(旧版)
89+
// ...
90+
tag {
91+
id: 123 // 标签id
92+
text: "" // 标签文字
93+
color: "#FFFFFFFF" // 标签颜色
94+
}
95+
// ...
96+
}
97+
recv_id: "7356666" // 接收者ID
98+
chat_id: "big" // 会话的ID
99+
chat_type: 2 // 会话的类型,1-用户 2-群组 3-机器人
100+
content {
101+
text: "Feng的大手发力了" // 消息文字
102+
// 剩下的建议参考proto,太多不写了
103+
}
104+
msg_type: 1 // 消息类型
105+
timestamp: 123456789 // 时间戳(毫秒)
106+
cmd {
107+
id; 999 // 指令ID
108+
name: "MAC地址查询" // 指令名称
109+
}
110+
msg_seq: 1145 // 消息序列
111+
}
112+
}
113+
```
114+
::: details ProtoBuf数据结构
115+
```proto
116+
// 共用区
117+
// 信息
118+
message INFO {
119+
string seq = 1; // 请求标识码
120+
string cmd = 2; // 操作类型
121+
}
122+
123+
// 标签
124+
message Tag {
125+
uint64 id = 1; // 标签ID(貌似)
126+
string text = 3;
127+
string color = 4;
128+
}
129+
// 共用区结束
130+
131+
// ws推送消息
132+
message push_message {
133+
INFO info = 1;
134+
Data data = 2;
135+
136+
message Data {
137+
string cmd = 1;
138+
Msg msg = 2;
139+
140+
message Msg {
141+
string msg_id = 1;
142+
Sender sender = 2;
143+
string recv_id = 3; // 接收者ID
144+
string chat_id = 4; // 会话的ID
145+
uint64 chat_type = 5; // 会话类型
146+
Content content = 6; // 消息内容
147+
uint64 msg_type = 7;
148+
uint64 timestamp = 8; // 时间戳(毫秒)
149+
Cmd cmd = 9; // 指令
150+
uint64 msg_seq = 12; // 消息序列
151+
152+
message Cmd {
153+
uint64 id = 1; // 命令ID
154+
string name = 2; // 命令名称
155+
}
156+
157+
message Sender {
158+
string chat_id = 1;
159+
uint64 chat_type = 2;
160+
string name = 3;
161+
string avatar_url = 4;
162+
repeated string tag_old = 6;
163+
repeated Tag tag = 7;
164+
}
165+
166+
message Content {
167+
string text = 1; // 消息内容
168+
string buttons = 2; // 按钮
169+
string image_url = 3;
170+
string file_name = 4;
171+
string file_url = 5;
172+
string quote_msg_text = 8; // 引用消息文字
173+
string sticker_url = 9; // 表情URL
174+
string post_id = 10; // 文章ID
175+
string post_title = 11; // 文章标题
176+
string post_content = 12; // 文章内容
177+
string post_content_type = 13; // 文章类型
178+
string expression_id = 15; // 个人表情ID(不知道为啥为STR)
179+
uint64 file_size = 18; // 文件/图片大小(字节)
180+
string video_url = 19; // 视频URL
181+
string audio_url = 21; // 语音URL
182+
uint64 audio_time = 22; // 语音时长
183+
uint64 sticker_item_id = 25; // 表情ID
184+
uint64 sticker_pack_id = 26; // 表情包ID
185+
string call_text = 29; // 语音通话文字
186+
string call_status_text = 32; // 语音通话状态文字
187+
uint64 width = 33; // 图片的宽度
188+
uint64 height = 34; // 图片的高度
189+
}
190+
}
191+
}
192+
}
193+
```
194+
:::

0 commit comments

Comments
 (0)