-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmsg.proto
89 lines (79 loc) · 1.71 KB
/
smsg.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
syntax = "proto3";
package smsg;
option go_package = "github.com/batigo/smsg";
// bati -> service msg
message BatiMsg {
// bati消息类型
enum BatiMsgType {
Unused = 0;
// 业务消息
Biz = 1;
// 长连接退出
ConnQuit = 2;
}
string id = 1;
BatiMsgType type = 2;
optional bytes data = 3;
// conn id
string cid = 4;
// user id
string uid = 5;
// client ip
optional string ip = 6;
// 消息从bati发出的时间戳,单位毫秒
uint64 ts = 7;
}
// service -> bati msg
message ServiceMsg {
enum ServiceMsgType {
Unused = 0;
// 加入房间消息
ConnJoin = 1;
// 退出房间消息
ConnQuit = 2;
// 业务消息
Biz = 3;
}
string id = 1;
string service = 2;
ServiceMsgType type = 3;
optional BizData biz_data = 4;
optional JoinData join_data = 5;
optional QuitData quit_data = 6;
// 从service发出消息的时间戳,单位毫秒
uint64 ts = 7;
}
message JoinData {
optional string cid = 1;
optional string uid = 2;
optional bool join_service = 3;
repeated string rooms = 4;
}
message QuitData {
optional string cid = 1;
optional string uid = 2;
optional bool quit_service = 3;
repeated string rooms = 4;
}
// 业务消息数据
message BizData {
enum BizMsgType {
Unused = 0;
// 指定发送给一批用户/conn
Users = 1;
// 一个房间内广播消息
Room = 2;
// 一个service广播消息
Service = 3;
// bati全局广播
All = 4;
}
BizMsgType type = 1;
repeated string cids = 2;
repeated string uids = 3;
optional string room = 4;
optional uint32 broadcast_ratio = 5;
repeated string black_uids = 6;
repeated string white_uids = 7;
optional bytes data = 8;
}