Skip to content

Instantly share code, notes, and snippets.

@FZambia
Last active February 14, 2018 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FZambia/2db85b772a2c6104f4fcf88716b814e2 to your computer and use it in GitHub Desktop.
Save FZambia/2db85b772a2c6104f4fcf88716b814e2 to your computer and use it in GitHub Desktop.
Clean Centrifugo v2 client proto
syntax = "proto3";
package proto;
message Error {
uint32 Code = 1;
string Message = 2;
}
enum MethodType {
CONNECT = 0;
REFRESH = 1;
SUBSCRIBE = 2;
UNSUBSCRIBE = 3;
PUBLISH = 4;
PRESENCE = 5;
PRESENCE_STATS = 6;
HISTORY = 7;
PING = 8;
RPC = 9;
MESSAGE = 10;
}
message Command {
uint32 ID = 1;
MethodType Method = 2;
bytes Params = 3;
}
message Reply {
uint32 ID = 1;
Error Error = 2;
bytes Result = 3;
}
enum MessageType {
PUBLICATION = 0;
JOIN = 1;
LEAVE = 2;
UNSUB = 3;
}
message Message {
MessageType Type = 1;
string Channel = 2;
bytes Data = 3;
}
message ClientInfo {
string User = 1;
string Client = 2;
bytes ConnInfo = 3;
bytes ChanInfo = 4;
}
message Publication {
string UID = 1;
bytes Data = 2;
ClientInfo Info = 3;
}
message Join {
ClientInfo Info = 1;
}
message Leave {
ClientInfo Info = 1;
}
message Unsub {}
message ConnectRequest {
string User = 1;
string Exp = 2;
string Info = 3;
string Opts = 4;
string Sign = 5;
}
message ConnectResponse {
Error Error = 1;
ConnectResult Result = 2;
}
message ConnectResult {
string Client = 1;
string Version = 2;
bool Expires = 3;
bool Expired = 4;
uint32 TTL = 5;
}
message RefreshRequest {
string User = 1;
string Exp = 2;
string Info = 3;
string Opts = 4;
string Sign = 5;
}
message RefreshResponse {
Error Error = 1;
RefreshResult Result = 2;
}
message RefreshResult {
string Client = 1;
string Version = 2;
bool Expires = 3;
bool Expired = 4;
uint32 TTL = 5;
}
message SubscribeRequest {
string Channel = 1;
string Client = 2;
string Info = 3;
string Sign = 4;
bool Recover = 5;
string Last = 6;
}
message SubscribeResponse {
Error Error = 1;
SubscribeResult Result = 2;
}
message SubscribeResult {
string Last = 1;
bool Recovered = 2;
repeated Publication Publications = 3;
}
message UnsubscribeRequest {
string Channel = 1;
}
message UnsubscribeResponse {
Error Error = 1;
UnsubscribeResult Result = 2;
}
message UnsubscribeResult {}
message PublishRequest {
string Channel = 1;
bytes Data = 2;
}
message PublishResponse {
Error Error = 1;
PublishResult Result = 2;
}
message PublishResult {}
message PresenceRequest {
string Channel = 1;
}
message PresenceResponse {
Error Error = 1;
PresenceResult Result = 2;
}
message PresenceResult {
map<string, ClientInfo> Presence = 1;
}
message PresenceStatsRequest {
string Channel = 1;
}
message PresenceStatsResponse {
Error Error = 1;
PresenceStatsResult Result = 2;
}
message PresenceStatsResult {
uint32 NumClients = 1;
uint32 NumUsers = 2;
}
message HistoryRequest {
string Channel = 1;
}
message HistoryResponse {
Error Error = 1;
HistoryResult Result = 2;
}
message HistoryResult {
repeated Publication Publications = 1;
}
message PingRequest {
string Data = 1;
}
message PingResponse {
Error Error = 1;
PingResult Result = 2;
}
message PingResult {
string Data = 1;
}
message RPCRequest{
bytes Data = 1;
}
message RPCResponse{
Error Error = 1;
bytes Result = 2;
}
message MessageRequest{
bytes Data = 1;
}
service Centrifugo {
rpc Communicate(stream Command) returns (stream Reply) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment