forked from centrifugal/centrifuge-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.proto
238 lines (198 loc) · 3.71 KB
/
client.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
syntax = "proto3";
package centrifugal.centrifuge.protocol;
option go_package = "./;protocol";
message Error {
uint32 code = 1;
string message = 2;
}
message Command {
uint32 id = 1;
enum MethodType {
CONNECT = 0;
SUBSCRIBE = 1;
UNSUBSCRIBE = 2;
PUBLISH = 3;
PRESENCE = 4;
PRESENCE_STATS = 5;
HISTORY = 6;
PING = 7;
SEND = 8;
RPC = 9;
REFRESH = 10;
SUB_REFRESH = 11;
}
MethodType method = 2;
bytes params = 3;
}
message Reply {
uint32 id = 1;
Error error = 2;
bytes result = 3;
}
message Push {
enum PushType {
PUBLICATION = 0;
JOIN = 1;
LEAVE = 2;
UNSUBSCRIBE = 3;
MESSAGE = 4;
SUBSCRIBE = 5;
CONNECT = 6;
DISCONNECT = 7;
REFRESH = 8;
}
PushType type = 1;
string channel = 2;
bytes data = 3;
}
message ClientInfo {
string user = 1;
string client = 2;
bytes conn_info = 3;
bytes chan_info = 4;
}
message Publication {
// 1-3 skipped here for backwards compatibility.
bytes data = 4;
ClientInfo info = 5;
uint64 offset = 6;
}
message Join {
ClientInfo info = 1;
}
message Leave {
ClientInfo info = 1;
}
message Unsubscribe {
// Field 1 removed (bool resubscribe).
}
message Subscribe {
bool recoverable = 1;
// 2-3 skipped here for backwards compatibility.
string epoch = 4;
uint64 offset = 5;
bool positioned = 6;
bytes data = 7;
}
message Message {
bytes data = 1;
}
message Connect {
string client = 1;
string version = 2;
bytes data = 3;
map<string, SubscribeResult> subs = 4;
bool expires = 5;
uint32 ttl = 6;
}
message Disconnect {
uint32 code = 1;
string reason = 2;
bool reconnect = 3;
}
message Refresh {
bool expires = 1;
uint32 ttl = 2;
}
message ConnectRequest {
string token = 1;
bytes data = 2;
map<string, SubscribeRequest> subs = 3;
string name = 4;
string version = 5;
}
message ConnectResult {
string client = 1;
string version = 2;
bool expires = 3;
uint32 ttl = 4;
bytes data = 5;
map<string, SubscribeResult> subs = 6;
}
message RefreshRequest {
string token = 1;
}
message RefreshResult {
string client = 1;
string version = 2;
bool expires = 3;
uint32 ttl = 4;
}
message SubscribeRequest {
string channel = 1;
string token = 2;
bool recover = 3;
// 4-5 skipped here for backwards compatibility.
string epoch = 6;
uint64 offset = 7;
}
message SubscribeResult {
bool expires = 1;
uint32 ttl = 2;
bool recoverable = 3;
// 4-5 skipped here for backwards compatibility.
string epoch = 6;
repeated Publication publications = 7;
bool recovered = 8;
uint64 offset = 9;
bool positioned = 10;
bytes data = 11;
}
message SubRefreshRequest {
string channel = 1;
string token = 2;
}
message SubRefreshResult {
bool expires = 1;
uint32 ttl = 2;
}
message UnsubscribeRequest {
string channel = 1;
}
message UnsubscribeResult {}
message PublishRequest {
string channel = 1;
bytes data = 2;
}
message PublishResult {}
message PresenceRequest {
string channel = 1;
}
message PresenceResult {
map<string, ClientInfo> presence = 1;
}
message PresenceStatsRequest {
string channel = 1;
}
message PresenceStatsResult {
uint32 num_clients = 1;
uint32 num_users = 2;
}
message StreamPosition {
uint64 offset = 1;
string epoch = 2;
}
message HistoryRequest {
string channel = 1;
// 2-6 skipped here for backwards compatibility.
int32 limit = 7;
StreamPosition since = 8;
bool reverse = 9;
}
message HistoryResult {
repeated Publication publications = 1;
string epoch = 2;
uint64 offset = 3;
}
message PingRequest {}
message PingResult {}
message RPCRequest{
bytes data = 1;
string method = 2;
}
message RPCResult {
bytes data = 1 ;
}
message SendRequest{
bytes data = 1;
}