-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMProtocol.proto
109 lines (88 loc) · 1.57 KB
/
IMProtocol.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
syntax = "proto3";
package Proto;
//
message Request {
// 包类型
enum Type {
LOGIN = 0;
LOGOUT = 1;
SENDMSG = 2;
}
Type type = 1;
oneof pdu {
Request_login request_login = 11;
Request_logout request_logout = 12;
Request_sendmsg request_sendmsg = 13;
}
}
// 服务端对客户端的响应
message Response {
// 类型
enum Type {
LOGIN = 0;
LOGOUT = 1;
SENDMSG = 2;
MESSAGE = 3;
}
Type type = 1;
oneof pdu {
Response_login response_login = 11;
//Response_logout response_logout = 12;
Response_sendmsg response_sendmsg = 13;
//其他账号发送的消息
Message msg = 14;
}
}
//登录请求
message Request_login {
uint64 ID = 1;
string password = 2;
// Next available id: 1
}
//登录应答
message Response_login {
// 是否登录成功
enum STAT {
SUCCESS = 0;
ACCOUNT_NULL = 1;
ACCOUNT_LOCK = 2;
PASSWORD_ERROR = 3;
ERROR = 10;
}
STAT stat = 1;
string friends = 2;
// Next available id: 1
}
//登出请求
message Request_logout {
uint64 ID = 1;
// Next available id: 1
}
////登出应答
//message Response_logout {
// uint64 ID = 1;
// // Next available id: 1
//}
//请求发送消
message Request_sendmsg {
uint32 msgID = 1; //消息ID
uint64 ID = 2; //自己的ID
uint64 objID = 3; //对方的ID
string msg = 4;
// Next available id: 1
}
//请求发送消
message Response_sendmsg {
uint32 msgID = 1;
bool stat = 2;
// Next available id: 1
}
// 消息推送
message Message {
// 消息类型
//enum MsgType {
//}
//MsgType type =1;
uint64 fromID =2;
string msg =3;
}