Repository navigation
Expand file tree
/
Copy pathapi.proto
More file actions
2028 lines (1843 loc) · 74.2 KB
/
Copy pathapi.proto
File metadata and controls
2028 lines (1843 loc) · 74.2 KB
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
syntax = "proto3";
package centrifugal.centrifugo.api;
option go_package = "./;apiproto";
// CentrifugoApi is the Centrifugo server API. HTTP and GRPC API share this
// schema. API-level errors are returned in the error field of each response,
// not as transport errors (unless transport error mode is enabled).
service CentrifugoApi {
rpc Batch(BatchRequest) returns (BatchResponse) {}
rpc Publish (PublishRequest) returns (PublishResponse) {}
rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {}
rpc Subscribe (SubscribeRequest) returns (SubscribeResponse) {}
rpc Unsubscribe (UnsubscribeRequest) returns (UnsubscribeResponse) {}
rpc Disconnect (DisconnectRequest) returns (DisconnectResponse) {}
rpc Presence (PresenceRequest) returns (PresenceResponse) {}
rpc PresenceStats (PresenceStatsRequest) returns (PresenceStatsResponse) {}
rpc History (HistoryRequest) returns (HistoryResponse) {}
rpc HistoryRemove (HistoryRemoveRequest) returns (HistoryRemoveResponse) {}
rpc Info (InfoRequest) returns (InfoResponse) {}
rpc RPC (RPCRequest) returns (RPCResponse) {}
rpc Refresh (RefreshRequest) returns (RefreshResponse) {}
rpc Channels (ChannelsRequest) returns (ChannelsResponse) {}
rpc Connections (ConnectionsRequest) returns (ConnectionsResponse) {}
rpc UpdateUserStatus (UpdateUserStatusRequest) returns (UpdateUserStatusResponse) {}
rpc GetUserStatus (GetUserStatusRequest) returns (GetUserStatusResponse) {}
rpc DeleteUserStatus (DeleteUserStatusRequest) returns (DeleteUserStatusResponse) {}
rpc BlockUser (BlockUserRequest) returns (BlockUserResponse) {}
rpc UnblockUser (UnblockUserRequest) returns (UnblockUserResponse) {}
rpc RevokeToken (RevokeTokenRequest) returns (RevokeTokenResponse) {}
rpc InvalidateUserTokens (InvalidateUserTokensRequest) returns (InvalidateUserTokensResponse) {}
rpc DeviceRegister (DeviceRegisterRequest) returns (DeviceRegisterResponse) {}
rpc DeviceUpdate (DeviceUpdateRequest) returns (DeviceUpdateResponse) {}
rpc DeviceRemove (DeviceRemoveRequest) returns (DeviceRemoveResponse) {}
rpc DeviceList (DeviceListRequest) returns (DeviceListResponse) {}
rpc DeviceTopicList (DeviceTopicListRequest) returns (DeviceTopicListResponse) {}
rpc DeviceTopicUpdate (DeviceTopicUpdateRequest) returns (DeviceTopicUpdateResponse) {}
rpc UserTopicList (UserTopicListRequest) returns (UserTopicListResponse) {}
rpc UserTopicUpdate (UserTopicUpdateRequest) returns (UserTopicUpdateResponse) {}
rpc SendPushNotification (SendPushNotificationRequest) returns (SendPushNotificationResponse) {}
rpc UpdatePushStatus (UpdatePushStatusRequest) returns (UpdatePushStatusResponse) {}
rpc CancelPush (CancelPushRequest) returns (CancelPushResponse) {}
rpc MapPublish (MapPublishRequest) returns (MapPublishResponse) {}
rpc MapRemove (MapRemoveRequest) returns (MapRemoveResponse) {}
rpc MapReadState (MapReadStateRequest) returns (MapReadStateResponse) {}
rpc MapReadStream (MapReadStreamRequest) returns (MapReadStreamResponse) {}
rpc MapStats (MapStatsRequest) returns (MapStatsResponse) {}
rpc MapClear (MapClearRequest) returns (MapClearResponse) {}
rpc SharedPollPublish (SharedPollPublishRequest) returns (SharedPollPublishResponse) {}
}
// Command is a single command inside a BatchRequest. Set exactly one of its
// request fields; a command with none of them set gets a not found error.
message Command {
reserved 1,2,3;
// publish is a publish command, see PublishRequest.
PublishRequest publish = 4;
// broadcast is a broadcast command, see BroadcastRequest.
BroadcastRequest broadcast = 5;
// subscribe is a subscribe command, see SubscribeRequest.
SubscribeRequest subscribe = 6;
// unsubscribe is an unsubscribe command, see UnsubscribeRequest.
UnsubscribeRequest unsubscribe = 7;
// disconnect is a disconnect command, see DisconnectRequest.
DisconnectRequest disconnect = 8;
// presence is a presence command, see PresenceRequest.
PresenceRequest presence = 9;
// presence_stats is a presence stats command, see PresenceStatsRequest.
PresenceStatsRequest presence_stats = 10;
// history is a history command, see HistoryRequest.
HistoryRequest history = 11;
// history_remove is a history remove command, see HistoryRemoveRequest.
HistoryRemoveRequest history_remove = 12;
// info is an info command, see InfoRequest.
InfoRequest info = 13;
// rpc is an RPC command, see RPCRequest.
RPCRequest rpc = 14;
// refresh is a refresh command, see RefreshRequest.
RefreshRequest refresh = 15;
// channels is a channels command, see ChannelsRequest.
ChannelsRequest channels = 16;
// connections is a connections command, see ConnectionsRequest.
// Centrifugo PRO only.
ConnectionsRequest connections = 17;
// update_user_status is an update user status command, see
// UpdateUserStatusRequest. Centrifugo PRO only.
UpdateUserStatusRequest update_user_status = 18;
// get_user_status is a get user status command, see GetUserStatusRequest.
// Centrifugo PRO only.
GetUserStatusRequest get_user_status = 19;
// delete_user_status is a delete user status command, see
// DeleteUserStatusRequest. Centrifugo PRO only.
DeleteUserStatusRequest delete_user_status = 20;
// block_user is a block user command, see BlockUserRequest.
// Centrifugo PRO only.
BlockUserRequest block_user = 21;
// unblock_user is an unblock user command, see UnblockUserRequest.
// Centrifugo PRO only.
UnblockUserRequest unblock_user = 22;
// revoke_token is a revoke token command, see RevokeTokenRequest.
// Centrifugo PRO only.
RevokeTokenRequest revoke_token = 23;
// invalidate_user_tokens is an invalidate user tokens command, see
// InvalidateUserTokensRequest. Centrifugo PRO only.
InvalidateUserTokensRequest invalidate_user_tokens = 24;
// device_register is a device register command, see
// DeviceRegisterRequest. Centrifugo PRO only.
DeviceRegisterRequest device_register = 25;
// device_update is a device update command, see DeviceUpdateRequest.
// Centrifugo PRO only.
DeviceUpdateRequest device_update = 26;
// device_remove is a device remove command, see DeviceRemoveRequest.
// Centrifugo PRO only.
DeviceRemoveRequest device_remove = 27;
// device_list is a device list command, see DeviceListRequest.
// Centrifugo PRO only.
DeviceListRequest device_list = 28;
// device_topic_list is a device topic list command, see
// DeviceTopicListRequest. Centrifugo PRO only.
DeviceTopicListRequest device_topic_list = 29;
// device_topic_update is a device topic update command, see
// DeviceTopicUpdateRequest. Centrifugo PRO only.
DeviceTopicUpdateRequest device_topic_update = 30;
// user_topic_list is a user topic list command, see
// UserTopicListRequest. Centrifugo PRO only.
UserTopicListRequest user_topic_list = 31;
// user_topic_update is a user topic update command, see
// UserTopicUpdateRequest. Centrifugo PRO only.
UserTopicUpdateRequest user_topic_update = 32;
// send_push_notification is a send push notification command, see
// SendPushNotificationRequest. Centrifugo PRO only.
SendPushNotificationRequest send_push_notification = 33;
// update_push_status is an update push status command, see
// UpdatePushStatusRequest. Centrifugo PRO only.
UpdatePushStatusRequest update_push_status = 34;
// cancel_push is a cancel push command, see CancelPushRequest.
// Centrifugo PRO only.
CancelPushRequest cancel_push = 35;
// map_publish is a map publish command, see MapPublishRequest.
MapPublishRequest map_publish = 36;
// map_remove is a map remove command, see MapRemoveRequest.
MapRemoveRequest map_remove = 37;
// map_read_state is a map read state command, see MapReadStateRequest.
MapReadStateRequest map_read_state = 38;
// map_read_stream is a map read stream command, see
// MapReadStreamRequest.
MapReadStreamRequest map_read_stream = 39;
// map_stats is a map stats command, see MapStatsRequest.
MapStatsRequest map_stats = 40;
// map_clear is a map clear command, see MapClearRequest.
MapClearRequest map_clear = 41;
// shared_poll_publish is a shared poll publish command, see
// SharedPollPublishRequest.
SharedPollPublishRequest shared_poll_publish = 42;
}
// Error is a Centrifugo API error. It has the same structure in every API
// response.
message Error {
// code is the Centrifugo error code: 100 (internal error), 102 (unknown
// channel), 104 (not found), 107 (bad request), 108 (not available),
// 111 (too many requests), 112 (unrecoverable position) or 113
// (conflict).
uint32 code = 1;
// message is a human-readable description of the error.
string message = 2;
// temporary is true when the same request may succeed if retried later:
// the error came from a temporary condition, such as a broker being
// unavailable or a rate limit, not from the request itself. It does not
// mean nothing was done: a publication may have happened despite the
// error. Retry a publication with the same idempotency_key, so that it
// is not published twice.
bool temporary = 3;
}
// Reply is the reply to a single Command of a BatchRequest. It carries
// either error or the result field matching the command.
message Reply {
reserved 1, 3;
// error is set if the command failed.
Error error = 2;
// publish is the result of a publish command.
PublishResult publish = 4;
// broadcast is the result of a broadcast command.
BroadcastResult broadcast = 5;
// subscribe is the result of a subscribe command.
SubscribeResult subscribe = 6;
// unsubscribe is the result of an unsubscribe command.
UnsubscribeResult unsubscribe = 7;
// disconnect is the result of a disconnect command.
DisconnectResult disconnect = 8;
// presence is the result of a presence command.
PresenceResult presence = 9;
// presence_stats is the result of a presence stats command.
PresenceStatsResult presence_stats = 10;
// history is the result of a history command.
HistoryResult history = 11;
// history_remove is the result of a history remove command.
HistoryRemoveResult history_remove = 12;
// info is the result of an info command.
InfoResult info = 13;
// rpc is the result of an RPC command.
RPCResult rpc = 14;
// refresh is the result of a refresh command.
RefreshResult refresh = 15;
// channels is the result of a channels command.
ChannelsResult channels = 16;
// connections is the result of a connections command.
// Centrifugo PRO only.
ConnectionsResult connections = 17;
// update_user_status is the result of an update user status command.
// Centrifugo PRO only.
UpdateUserStatusResult update_user_status = 18;
// get_user_status is the result of a get user status command.
// Centrifugo PRO only.
GetUserStatusResult get_user_status = 19;
// delete_user_status is the result of a delete user status command.
// Centrifugo PRO only.
DeleteUserStatusResult delete_user_status = 20;
// block_user is the result of a block user command.
// Centrifugo PRO only.
BlockUserResult block_user = 21;
// unblock_user is the result of an unblock user command.
// Centrifugo PRO only.
UnblockUserResult unblock_user = 22;
// revoke_token is the result of a revoke token command.
// Centrifugo PRO only.
RevokeTokenResult revoke_token = 23;
// invalidate_user_tokens is the result of an invalidate user tokens
// command. Centrifugo PRO only.
InvalidateUserTokensResult invalidate_user_tokens = 24;
// device_register is the result of a device register command.
// Centrifugo PRO only.
DeviceRegisterResult device_register = 25;
// device_update is the result of a device update command.
// Centrifugo PRO only.
DeviceUpdateResult device_update = 26;
// device_remove is the result of a device remove command.
// Centrifugo PRO only.
DeviceRemoveResult device_remove = 27;
// device_list is the result of a device list command.
// Centrifugo PRO only.
DeviceListResult device_list = 28;
// device_topic_list is the result of a device topic list command.
// Centrifugo PRO only.
DeviceTopicListResult device_topic_list = 29;
// device_topic_update is the result of a device topic update command.
// Centrifugo PRO only.
DeviceTopicUpdateResult device_topic_update = 30;
// user_topic_list is the result of a user topic list command.
// Centrifugo PRO only.
UserTopicListResult user_topic_list = 31;
// user_topic_update is the result of a user topic update command.
// Centrifugo PRO only.
UserTopicUpdateResult user_topic_update = 32;
// send_push_notification is the result of a send push notification
// command. Centrifugo PRO only.
SendPushNotificationResult send_push_notification = 33;
// update_push_status is the result of an update push status command.
// Centrifugo PRO only.
UpdatePushStatusResult update_push_status = 34;
// cancel_push is the result of a cancel push command.
// Centrifugo PRO only.
CancelPushResult cancel_push = 35;
// map_publish is the result of a map publish command.
MapPublishResult map_publish = 36;
// map_remove is the result of a map remove command.
MapRemoveResult map_remove = 37;
// map_read_state is the result of a map read state command.
MapReadStateResult map_read_state = 38;
// map_read_stream is the result of a map read stream command.
MapReadStreamResult map_read_stream = 39;
// map_stats is the result of a map stats command.
MapStatsResult map_stats = 40;
// map_clear is the result of a map clear command.
MapClearResult map_clear = 41;
// shared_poll_publish is the result of a shared poll publish command.
SharedPollPublishResult shared_poll_publish = 42;
}
// BatchRequest sends many commands in one request, which avoids paying a
// round trip per command. Check the error of each reply individually.
message BatchRequest {
// commands to execute. Replies come back in the same order.
repeated Command commands = 1;
// parallel makes Centrifugo process the commands concurrently instead of
// one after another. This may reduce latency (especially with the Redis
// engine), but gives no ordering guarantee between commands.
bool parallel = 2;
}
// BatchResponse contains the replies to a BatchRequest.
message BatchResponse {
// replies to the commands, in the order of BatchRequest.commands.
repeated Reply replies = 1;
}
// PublishRequest publishes data into a channel.
message PublishRequest {
// channel is the name of the channel to publish into. Required.
string channel = 1;
// data is the payload to publish. Required unless b64data is set. In the
// HTTP API it is any JSON value; over GRPC it may be binary.
bytes data = 2;
// b64data is a base64-encoded binary payload, an alternative to `data` to
// send binary over the HTTP API. Centrifugo decodes it before publishing.
string b64data = 3;
// skip_history skips adding this publication to the channel history.
bool skip_history = 4;
// tags is a map of arbitrary string keys and values attached to the
// publication and delivered to clients.
map<string, string> tags = 5;
// idempotency_key drops duplicate publications upon retries. It acts per
// channel; results are cached for 5 minutes. Supported only by Memory and
// Redis engines.
string idempotency_key = 6;
// delta tells Centrifugo to construct a delta update, if possible, when
// broadcasting the publication to subscribers.
bool delta = 7;
// version, when > 0, is the version of the document being sent:
// publications with a version less than or equal to one already seen are
// ignored. Only works in channels with history enabled.
uint64 version = 8;
// version_epoch is the epoch of version. When it changes, Centrifugo
// accepts the publication even if its version is lower than before.
string version_epoch = 9;
}
// PublishResponse is the response to a PublishRequest.
message PublishResponse {
// error is set if the publish failed.
Error error = 1;
// result is set on success.
PublishResult result = 2;
}
// PublishResult is the result of a successful publish.
message PublishResult {
// offset is the offset of the publication in the channel history stream.
uint64 offset = 1;
// epoch is the epoch of the channel history stream.
string epoch = 2;
}
// BroadcastRequest publishes the same data into many channels.
message BroadcastRequest {
// channels is the list of channels to publish into. Required.
repeated string channels = 1;
// data is the payload to publish into each channel. Required unless
// b64data is set. In the HTTP API it is any JSON value; over GRPC it may
// be binary.
bytes data = 2;
// b64data is a base64-encoded binary payload, an alternative to `data` to
// send binary over the HTTP API. Centrifugo decodes it before publishing.
string b64data = 3;
// skip_history skips adding the publications to the channels' history.
bool skip_history = 4;
// tags is a map of arbitrary string keys and values attached to each
// publication and delivered to clients.
map<string, string> tags = 5;
// idempotency_key drops duplicate publications upon retries. It acts per
// channel; results are cached for 5 minutes.
string idempotency_key = 6;
// delta tells Centrifugo to construct a delta update, if possible, when
// broadcasting the publications to subscribers.
bool delta = 7;
// version, when > 0, is the version of the document being sent:
// publications with a version less than or equal to one already seen are
// ignored. Only works in channels with history enabled.
uint64 version = 8;
// version_epoch is the epoch of version. When it changes, Centrifugo
// accepts the publication even if its version is lower than before.
string version_epoch = 9;
}
// BroadcastResponse is the response to a BroadcastRequest.
message BroadcastResponse {
// error is set if the whole broadcast failed.
Error error = 1;
// result is set on success. Check the error of each response in it.
BroadcastResult result = 2;
}
// BroadcastResult is the result of a broadcast.
message BroadcastResult {
// responses is a publish response for each channel, in the order of
// BroadcastRequest.channels. Each may carry its own error.
repeated PublishResponse responses = 1;
}
// FilterNode is a tree describing a predicate over client labels. Used as
// label_filter on Subscribe, Unsubscribe, Disconnect, Refresh and
// Connections requests. A node is either a leaf comparison (key, cmp, val or
// vals) or a logical operation (op) over child nodes.
// Centrifugo PRO only: defined here for protocol-surface consistency,
// Centrifugo OSS parses it but ignores it.
message FilterNode {
// op is the logical operation of a non-leaf node: "and", "or" or "not".
// Empty for a leaf node.
string op = 1;
// key is the label key a leaf node compares.
string key = 2;
// cmp is the comparison of a leaf node: "eq", "neq", "in", "nin", "ex",
// "nex", "sw", "ew", "ct", "gt", "gte", "lt" or "lte".
string cmp = 3;
// val is the value to compare with, for single-value comparisons.
string val = 4;
// vals are the values to compare with, for "in" and "nin".
repeated string vals = 5;
// nodes are the child nodes of a logical operation.
repeated FilterNode nodes = 6;
}
// SubscribeRequest subscribes active sessions of a user to a channel
// (server-side subscription). It does not create a streaming subscription
// for the caller.
message SubscribeRequest {
// channel is the name of the channel to subscribe to. Required.
string channel = 1;
// user is the ID of the user to subscribe. Required, unless all_users is
// used in Centrifugo PRO.
string user = 2;
// expire_at is the Unix time in seconds when the subscription expires.
int64 expire_at = 3;
// info is custom channel info attached to the subscription, used in
// presence and join/leave messages.
bytes info = 4;
// b64info is info as base64, for binary. Centrifugo decodes it.
string b64info = 5;
// client limits the call to the connection with this client ID. user is
// still required.
string client = 6;
// data is custom subscription data sent to the client in the Subscribe
// push.
bytes data = 7;
// b64data is data as base64, for binary. Centrifugo decodes it.
string b64data = 8;
// recover_since is the stream position to recover publications from.
StreamPosition recover_since = 9;
// override dynamically overrides some channel options set in the
// Centrifugo configuration.
SubscribeOptionOverride override = 10;
// session limits the call to the connection with this session ID. user
// is still required.
string session = 11;
// label_filter restricts the call to clients whose labels match this
// filter. Centrifugo PRO only.
FilterNode label_filter = 12;
// all_users, when user is empty, targets every connection on every node
// instead of the anonymous-only bucket. No effect when user is non-empty.
// Without label_filter it acts on every connection. Centrifugo PRO only.
bool all_users = 13;
}
// SubscribeResponse is the response to a SubscribeRequest.
message SubscribeResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
SubscribeResult result = 2;
}
// BoolValue wraps a bool so that an unset value can be told apart from
// false.
message BoolValue {
// value is the wrapped value.
bool value = 1;
}
// Int32Value wraps an int32 so that an unset value can be told apart from
// zero.
message Int32Value {
// value is the wrapped value.
int32 value = 1;
}
// SubscribeOptionOverride overrides channel options for a server-side
// subscription. Unset fields keep the value from the channel configuration.
message SubscribeOptionOverride {
// presence overrides the presence channel option.
BoolValue presence = 1;
// join_leave overrides the join_leave channel option.
BoolValue join_leave = 2;
// force_recovery overrides the force_recovery channel option.
BoolValue force_recovery = 3;
// force_positioning overrides the force_positioning channel option.
BoolValue force_positioning = 4;
// force_push_join_leave overrides the force_push_join_leave channel
// option.
BoolValue force_push_join_leave = 5;
}
// SubscribeResult is the result of a subscribe call. Empty at the moment.
message SubscribeResult {}
// UnsubscribeRequest unsubscribes a user from a channel.
message UnsubscribeRequest {
// channel is the name of the channel to unsubscribe from. Required.
string channel = 1;
// user is the ID of the user to unsubscribe. Required, unless all_users
// is used in Centrifugo PRO.
string user = 2;
// client limits the call to the connection with this client ID. user is
// still required.
string client = 3;
// session limits the call to the connection with this session ID. user
// is still required.
string session = 4;
// label_filter restricts the call to clients whose labels match this
// filter. Centrifugo PRO only.
FilterNode label_filter = 5;
// all_users works as SubscribeRequest.all_users. Centrifugo PRO only.
bool all_users = 6;
}
// UnsubscribeResponse is the response to an UnsubscribeRequest.
message UnsubscribeResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
UnsubscribeResult result = 2;
}
// UnsubscribeResult is the result of an unsubscribe call. Empty at the
// moment.
message UnsubscribeResult {}
// Disconnect describes the code and reason clients are disconnected with.
message Disconnect {
reserved 3;
// code is the disconnect code.
uint32 code = 1;
// reason is the disconnect reason.
string reason = 2;
}
// DisconnectRequest disconnects a user's connections.
message DisconnectRequest {
// user is the ID of the user to disconnect. Required, unless all_users is
// used in Centrifugo PRO.
string user = 1;
// disconnect is a custom disconnect code and reason. If not set, clients
// are disconnected with a force no-reconnect disconnect.
Disconnect disconnect = 2;
// client limits the call to the connection with this client ID. user is
// still required.
string client = 3;
// whitelist is a list of client IDs to keep connected.
repeated string whitelist = 4;
// session limits the call to the connection with this session ID. user
// is still required.
string session = 5;
// label_filter restricts the call to clients whose labels match this
// filter. Centrifugo PRO only.
FilterNode label_filter = 6;
// all_users works as SubscribeRequest.all_users. Centrifugo PRO only.
bool all_users = 7;
}
// DisconnectResponse is the response to a DisconnectRequest.
message DisconnectResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
DisconnectResult result = 2;
}
// DisconnectResult is the result of a disconnect call. Empty at the moment.
message DisconnectResult {}
// PresenceRequest returns the online presence of a channel: all clients
// currently subscribed to it. Presence must be enabled for the channel.
message PresenceRequest {
// channel is the name of the channel. Required.
string channel = 1;
}
// PresenceResponse is the response to a PresenceRequest.
message PresenceResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
PresenceResult result = 2;
}
// ClientInfo describes a client connection.
message ClientInfo {
// user is the user ID.
string user = 1;
// client is the client ID.
string client = 2;
// conn_info is optional connection info.
bytes conn_info = 3;
// chan_info is optional channel info.
bytes chan_info = 4;
}
// PresenceResult is the result of a presence call.
message PresenceResult {
// presence maps client ID to information about the client.
map<string, ClientInfo> presence = 1;
}
// PresenceStatsRequest returns short presence information of a channel: the
// number of clients and of unique users. Presence must be enabled for the
// channel.
message PresenceStatsRequest {
// channel is the name of the channel. Required.
string channel = 1;
}
// PresenceStatsResponse is the response to a PresenceStatsRequest.
message PresenceStatsResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
PresenceStatsResult result = 2;
}
// PresenceStatsResult is the result of a presence stats call.
message PresenceStatsResult {
// num_clients is the total number of clients in the channel.
uint32 num_clients = 1;
// num_users is the number of unique users in the channel.
uint32 num_users = 2;
}
// StreamPosition is a position in a channel stream.
message StreamPosition {
// offset is the offset in the stream.
uint64 offset = 1;
// epoch is the stream epoch.
string epoch = 2;
}
// HistoryRequest returns publications from the history of a channel.
// History must be enabled for the channel.
message HistoryRequest {
// channel is the name of the channel. Required.
string channel = 1;
// limit is the maximum number of publications to return; -1 returns all
// the channel keeps. If not set, only the current stream position is
// returned, without publications.
int32 limit = 2;
// since returns publications after this stream position.
StreamPosition since = 3;
// reverse iterates in reverse order, from latest to earliest.
bool reverse = 4;
}
// HistoryResponse is the response to a HistoryRequest.
message HistoryResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
HistoryResult result = 2;
}
// Publication is a publication in a channel history.
message Publication {
// Removed: string uid = 1;
// data is the publication payload.
bytes data = 2;
// info is information about the client that published, if any.
ClientInfo info = 3;
// offset is the offset of the publication in the history stream.
uint64 offset = 4;
// tags are the publication tags.
map<string, string> tags = 5;
}
// HistoryResult is the result of a history call.
message HistoryResult {
// publications is the list of publications.
repeated Publication publications = 1;
// epoch is the epoch of the current stream.
string epoch = 2;
// offset is the top offset of the history stream.
uint64 offset = 3;
}
// HistoryRemoveRequest removes publications from the history of a channel.
// The current top stream position is kept, so clients do not get
// disconnected because of insufficient state.
message HistoryRemoveRequest {
// channel is the name of the channel. Required.
string channel = 1;
}
// HistoryRemoveResponse is the response to a HistoryRemoveRequest.
message HistoryRemoveResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
HistoryRemoveResult result = 2;
}
// HistoryRemoveResult is the result of a history remove call. Empty at the
// moment.
message HistoryRemoveResult {}
// InfoRequest returns information about the running Centrifugo nodes.
message InfoRequest {}
// InfoResponse is the response to an InfoRequest.
message InfoResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
InfoResult result = 2;
}
// InfoResult is the result of an info call.
message InfoResult {
// nodes is information about all nodes of the cluster.
repeated NodeResult nodes = 1;
}
// RPCRequest calls a custom server API method registered as an RPC
// extension.
message RPCRequest {
// method is the name of the method to call. Required.
string method = 1;
// params are the method parameters.
bytes params = 2;
}
// RPCResponse is the response to an RPCRequest.
message RPCResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
RPCResult result = 2;
}
// RPCResult is the result of an RPC call.
message RPCResult {
// data is the data returned by the method.
bytes data = 1;
}
// RefreshRequest refreshes a user's connections, mostly useful with
// unidirectional transports. Without expire_at the connections become
// non-expiring.
message RefreshRequest {
// user is the ID of the user to refresh. Required, unless all_users is
// used in Centrifugo PRO.
string user = 1;
// client limits the call to the connection with this client ID. user is
// still required.
string client = 2;
// expired marks the connections as expired and closes them with an
// expired disconnect reason.
bool expired = 3;
// expire_at is the Unix time in seconds when the connections expire.
int64 expire_at = 4;
// info attaches or replaces the connection info.
bytes info = 5;
// session limits the call to the connection with this session ID. user
// is still required.
string session = 6;
// label_filter restricts the call to clients whose labels match this
// filter. Centrifugo PRO only.
FilterNode label_filter = 7;
// all_users works as SubscribeRequest.all_users. Centrifugo PRO only.
bool all_users = 8;
}
// RefreshResponse is the response to a RefreshRequest.
message RefreshResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
RefreshResult result = 2;
}
// RefreshResult is the result of a refresh call. Empty at the moment.
message RefreshResult {}
// NodeResult is information about a Centrifugo node.
message NodeResult {
// uid is the unique ID of the node.
string uid = 1;
// name is the node name.
string name = 2;
// version is the Centrifugo version of the node.
string version = 3;
// num_clients is the number of clients connected to the node.
uint32 num_clients = 4;
// num_users is the number of unique users connected to the node.
uint32 num_users = 5;
// num_channels is the number of active channels on the node.
uint32 num_channels = 6;
// uptime is the node uptime in seconds.
uint32 uptime = 7;
// metrics are aggregated node metrics, if available.
Metrics metrics = 8;
// process is CPU and memory usage of the node process.
// Centrifugo PRO only.
Process process = 9;
// num_subs is the number of subscriptions on the node.
uint32 num_subs = 10;
}
// Metrics are aggregated metrics of a node.
message Metrics {
// interval is the metrics aggregation interval in seconds.
double interval = 1;
// items maps metric name to value.
map<string, double> items = 2;
}
// Process is resource usage of a node process. Centrifugo PRO only.
message Process {
// cpu is the CPU usage of the process in percent.
double cpu = 1;
// rss is the resident set size of the process in bytes.
int64 rss = 2;
}
// ChannelsRequest returns active channels (with one or more subscribers).
// It can be heavy on large deployments: there is no pagination.
message ChannelsRequest {
// pattern filters channels by name, using gobwas/glob syntax.
string pattern = 1;
}
// ChannelsResponse is the response to a ChannelsRequest.
message ChannelsResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
ChannelsResult result = 2;
}
// ChannelsResult is the result of a channels call.
message ChannelsResult {
// channels maps channel name to information about the channel.
map<string, ChannelInfo> channels = 1;
}
// ChannelInfo is information about an active channel.
message ChannelInfo {
// num_clients is the number of connections subscribed to the channel.
uint32 num_clients = 1;
}
// ConnectionsRequest returns information about active connections, without
// the need to enable presence. At least one of user, expression or
// label_filter must be set. Centrifugo PRO only.
message ConnectionsRequest {
// user returns only the connections of this user ID.
string user = 1;
// expression is a CEL expression to filter connections.
string expression = 2;
// label_filter restricts the listing to clients whose labels match this
// filter. Centrifugo PRO only.
FilterNode label_filter = 3;
}
// ConnectionsResponse is the response to a ConnectionsRequest.
// Centrifugo PRO only.
message ConnectionsResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
ConnectionsResult result = 2;
}
// ConnectionsResult is the result of a connections call.
// Centrifugo PRO only.
message ConnectionsResult {
// connections maps client ID to information about the connection.
map<string, ConnectionInfo> connections = 1;
}
// ConnectionInfo is information about a client connection.
// Centrifugo PRO only.
message ConnectionInfo {
reserved 5, 7;
// app_name is the client application name, if provided by the client.
string app_name = 1;
// app_version is the client application version, if provided by the
// client.
string app_version = 2;
// transport is the name of the connection transport.
string transport = 3;
// protocol is the connection protocol: json or protobuf.
string protocol = 4;
// user is the user ID of the connection.
string user = 8;
// state is the connection state.
ConnectionState state = 9;
// connected_at_ms is the Unix time in milliseconds when the connection
// was established.
int64 connected_at_ms = 10;
// ping_pong_latency_ms is the last measured client ping/pong round-trip
// latency in milliseconds. Can be -1 if not available.
int64 ping_pong_latency_ms = 11;
// labels are the client labels attached to the connection.
map<string, string> labels = 12;
}
// ConnectionState is the state of a client connection.
// Centrifugo PRO only.
message ConnectionState {
// channels maps the channels the client is subscribed to to their
// context.
map<string, ChannelContext> channels = 1;
// connection_token is information about the connection token.
ConnectionTokenInfo connection_token = 2;
// subscription_tokens maps channel to information about the subscription
// token used to subscribe to it.
map<string, SubscriptionTokenInfo> subscription_tokens = 3;
// meta is the meta information attached to the connection. It is not
// visible to the client.
bytes meta = 4;
}
// ChannelContext is context of a channel subscription.
// Centrifugo PRO only.
message ChannelContext {
// source is the source of the channel subscription (for example,
// subscription token, subscribe proxy or server API).
uint32 source = 1;
}
// ConnectionTokenInfo is information about a connection token.
// Centrifugo PRO only.
message ConnectionTokenInfo {
// uid is the unique token ID (jti claim).
string uid = 1;
// issued_at is the Unix time in seconds when the token was issued.
int64 issued_at = 2;
}
// SubscriptionTokenInfo is information about a subscription token.
// Centrifugo PRO only.
message SubscriptionTokenInfo {
// uid is the unique token ID (jti claim).
string uid = 1;
// issued_at is the Unix time in seconds when the token was issued.
int64 issued_at = 2;
}
// UpdateUserStatusRequest marks users as active and online now, and sets
// their state when one is given. Centrifugo PRO only.
message UpdateUserStatusRequest {
// users is the list of user IDs to update the status for. Required.
repeated string users = 1;
// state is an optional custom state to store in the user status. It can
// be restricted by the user_status.state_regex option.
string state = 2;
}
// UpdateUserStatusResponse is the response to an UpdateUserStatusRequest.
// Centrifugo PRO only.
message UpdateUserStatusResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
UpdateUserStatusResult result = 2;
}
// UpdateUserStatusResult is the result of an update user status call. Empty
// at the moment. Centrifugo PRO only.
message UpdateUserStatusResult {}
// GetUserStatusRequest returns the status of users. Centrifugo PRO only.
message GetUserStatusRequest {
// users is the list of user IDs to get the status for. Required.
repeated string users = 1;
}
// GetUserStatusResponse is the response to a GetUserStatusRequest.
// Centrifugo PRO only.
message GetUserStatusResponse {
// error is set if the call failed.
Error error = 1;
// result is set on success.
GetUserStatusResult result = 2;
}
// GetUserStatusResult is the result of a get user status call.
// Centrifugo PRO only.
message GetUserStatusResult {
// statuses are the statuses of the requested users, in the same order.
repeated UserStatus statuses = 1;
}
// UserStatus is the status of a user. Centrifugo PRO only.
message UserStatus {
// user is the user ID.