| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package protocol; |
| 4 |
{{if env.Getenv "GOGO"}} |
| 5 |
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
| 6 |
|
| 7 |
option (gogoproto.equal_all) = true; |
| 8 |
option (gogoproto.populate_all) = true; |
| 9 |
option (gogoproto.testgen_all) = true; |
| 10 |
{{end}} |
| 11 |
message Error { |
| 12 |
uint32 code = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "code"]{{end}}; |
| 13 |
string message = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "message"]{{end}}; |
| 14 |
} |
| 15 |
|
| 16 |
enum MethodType { |
| 17 |
{{ if env.Getenv "GOGO" -}}option (gogoproto.goproto_enum_prefix) = false; |
| 18 |
{{ end -}} |
| 19 |
CONNECT = 0{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeConnect"]{{end}}; |
| 20 |
SUBSCRIBE = 1{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeSubscribe"]{{end}}; |
| 21 |
UNSUBSCRIBE = 2{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeUnsubscribe"]{{end}}; |
| 22 |
PUBLISH = 3{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypePublish"]{{end}}; |
| 23 |
PRESENCE = 4{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypePresence"]{{end}}; |
| 24 |
PRESENCE_STATS = 5{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypePresenceStats"]{{end}}; |
| 25 |
HISTORY = 6{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeHistory"]{{end}}; |
| 26 |
PING = 7{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypePing"]{{end}}; |
| 27 |
SEND = 8{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeSend"]{{end}}; |
| 28 |
RPC = 9{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeRPC"]{{end}}; |
| 29 |
REFRESH = 10{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeRefresh"]{{end}}; |
| 30 |
SUB_REFRESH = 11{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "MethodTypeSubRefresh"]{{end}}; |
| 31 |
} |
| 32 |
|
| 33 |
message Command { |
| 34 |
uint32 id = 1{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id,omitempty"]{{end}}; |
| 35 |
MethodType method = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "method,omitempty"]{{end}}; |
| 36 |
bytes params = 3{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "params,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 37 |
} |
| 38 |
|
| 39 |
message Reply { |
| 40 |
uint32 id = 1{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "ID", (gogoproto.jsontag) = "id,omitempty"]{{end}}; |
| 41 |
Error error = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "error,omitempty"]{{end}}; |
| 42 |
bytes result = 3{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "result,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 43 |
} |
| 44 |
|
| 45 |
enum PushType { |
| 46 |
{{ if env.Getenv "GOGO" -}}option (gogoproto.goproto_enum_prefix) = false; |
| 47 |
{{ end -}} |
| 48 |
PUBLICATION = 0{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypePublication"]{{end}}; |
| 49 |
JOIN = 1{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypeJoin"]{{end}}; |
| 50 |
LEAVE = 2{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypeLeave"]{{end}}; |
| 51 |
UNSUB = 3{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypeUnsub"]{{end}}; |
| 52 |
MESSAGE = 4{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypeMessage"]{{end}}; |
| 53 |
SUB = 5{{if env.Getenv "GOGO"}} [(gogoproto.enumvalue_customname) = "PushTypeSub"]{{end}}; |
| 54 |
} |
| 55 |
|
| 56 |
message Push { |
| 57 |
PushType type = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "type,omitempty"]{{end}}; |
| 58 |
string channel = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel,omitempty"]{{end}}; |
| 59 |
bytes data = 3{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 60 |
} |
| 61 |
|
| 62 |
message ClientInfo { |
| 63 |
string user = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "user"]{{end}}; |
| 64 |
string client = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "client"]{{end}}; |
| 65 |
bytes conn_info = 3{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "conn_info,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 66 |
bytes chan_info = 4{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "chan_info,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 67 |
} |
| 68 |
|
| 69 |
message Publication { |
| 70 |
uint32 seq = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "seq,omitempty"]{{end}}; |
| 71 |
uint32 gen = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "gen,omitempty"]{{end}}; |
| 72 |
string uid = 3{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "UID", (gogoproto.jsontag) = "uid,omitempty"]{{end}}; |
| 73 |
bytes data = 4{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 74 |
ClientInfo info = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "info,omitempty"]{{end}}; |
| 75 |
uint64 offset = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset,omitempty"]{{end}}; |
| 76 |
} |
| 77 |
|
| 78 |
message Join { |
| 79 |
ClientInfo info = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "info", (gogoproto.nullable) = false]{{end}}; |
| 80 |
} |
| 81 |
|
| 82 |
message Leave { |
| 83 |
ClientInfo info = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "info", (gogoproto.nullable) = false]{{end}}; |
| 84 |
} |
| 85 |
|
| 86 |
message Unsub { |
| 87 |
bool resubscribe =1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "resubscribe,omitempty"]{{end}}; |
| 88 |
} |
| 89 |
|
| 90 |
message Sub { |
| 91 |
bool recoverable = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "recoverable,omitempty"]{{end}}; |
| 92 |
uint32 seq = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "seq,omitempty"]{{end}}; |
| 93 |
uint32 gen = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "gen,omitempty"]{{end}}; |
| 94 |
string epoch = 4{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "epoch,omitempty"]{{end}}; |
| 95 |
uint64 offset = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset,omitempty"]{{end}}; |
| 96 |
bool positioned = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "positioned,omitempty"]{{end}}; |
| 97 |
} |
| 98 |
|
| 99 |
message Message { |
| 100 |
bytes data = 1{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 101 |
} |
| 102 |
|
| 103 |
message ConnectRequest { |
| 104 |
string token = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "token,omitempty"]{{end}}; |
| 105 |
bytes data = 2{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 106 |
map<string, SubscribeRequest> subs = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "subs,omitempty"]{{end}}; |
| 107 |
string name = 4{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "name,omitempty"]{{end}}; |
| 108 |
string version = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "version,omitempty"]{{end}}; |
| 109 |
} |
| 110 |
|
| 111 |
message ConnectResult { |
| 112 |
string client = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "client"]{{end}}; |
| 113 |
string version = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "version"]{{end}}; |
| 114 |
bool expires = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "expires,omitempty"]{{end}}; |
| 115 |
uint32 ttl = 4{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "TTL", (gogoproto.jsontag) = "ttl,omitempty"]{{end}}; |
| 116 |
bytes data = 5{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 117 |
map<string, SubscribeResult> subs = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "subs,omitempty"]{{end}}; |
| 118 |
} |
| 119 |
|
| 120 |
message RefreshRequest { |
| 121 |
string token = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "token"]{{end}}; |
| 122 |
} |
| 123 |
|
| 124 |
message RefreshResult { |
| 125 |
string client = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "client"]{{end}}; |
| 126 |
string version = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "version"]{{end}}; |
| 127 |
bool expires = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "expires,omitempty"]{{end}}; |
| 128 |
uint32 ttl = 4{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "TTL", (gogoproto.jsontag) = "ttl,omitempty"]{{end}}; |
| 129 |
} |
| 130 |
|
| 131 |
message SubscribeRequest { |
| 132 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel,omitempty"]{{end}}; |
| 133 |
string token = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "token,omitempty"]{{end}}; |
| 134 |
bool recover = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "recover,omitempty"]{{end}}; |
| 135 |
uint32 seq = 4{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "seq,omitempty"]{{end}}; |
| 136 |
uint32 gen = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "gen,omitempty"]{{end}}; |
| 137 |
string epoch = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "epoch,omitempty"]{{end}}; |
| 138 |
uint64 offset = 7{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset,omitempty"]{{end}}; |
| 139 |
} |
| 140 |
|
| 141 |
message SubscribeResult { |
| 142 |
bool expires = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "expires,omitempty"]{{end}}; |
| 143 |
uint32 ttl = 2{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "TTL", (gogoproto.jsontag) = "ttl,omitempty"]{{end}}; |
| 144 |
bool recoverable = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "recoverable,omitempty"]{{end}}; |
| 145 |
uint32 seq = 4{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "seq,omitempty"]{{end}}; |
| 146 |
uint32 gen = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "gen,omitempty"]{{end}}; |
| 147 |
string epoch = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "epoch,omitempty"]{{end}}; |
| 148 |
repeated Publication publications = 7{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "publications,omitempty"]{{end}}; |
| 149 |
bool recovered = 8{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "recovered,omitempty"]{{end}}; |
| 150 |
uint64 offset = 9{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset,omitempty"]{{end}}; |
| 151 |
bool positioned = 10{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "positioned,omitempty"]{{end}}; |
| 152 |
} |
| 153 |
|
| 154 |
message SubRefreshRequest { |
| 155 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 156 |
string token = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "token"]{{end}}; |
| 157 |
} |
| 158 |
|
| 159 |
message SubRefreshResult { |
| 160 |
bool expires = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "expires,omitempty"]{{end}}; |
| 161 |
uint32 ttl = 2{{if env.Getenv "GOGO"}} [(gogoproto.customname) = "TTL", (gogoproto.jsontag) = "ttl,omitempty"]{{end}}; |
| 162 |
} |
| 163 |
|
| 164 |
message UnsubscribeRequest { |
| 165 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 166 |
} |
| 167 |
|
| 168 |
message UnsubscribeResult {} |
| 169 |
|
| 170 |
message PublishRequest { |
| 171 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 172 |
bytes data = 2{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 173 |
} |
| 174 |
|
| 175 |
message PublishResult {} |
| 176 |
|
| 177 |
message PresenceRequest { |
| 178 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 179 |
} |
| 180 |
|
| 181 |
message PresenceResult { |
| 182 |
map<string, ClientInfo> presence = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "presence"]{{end}}; |
| 183 |
} |
| 184 |
|
| 185 |
message PresenceStatsRequest { |
| 186 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 187 |
} |
| 188 |
|
| 189 |
message PresenceStatsResult { |
| 190 |
uint32 num_clients = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "num_clients"]{{end}}; |
| 191 |
uint32 num_users = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "num_users"]{{end}}; |
| 192 |
} |
| 193 |
|
| 194 |
message HistoryRequest { |
| 195 |
string channel = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "channel"]{{end}}; |
| 196 |
bool use_since = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "use_since,omitempty"]{{end}}; |
| 197 |
uint64 offset = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset,omitempty"]{{end}}; |
| 198 |
string epoch = 4{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "epoch,omitempty"]{{end}}; |
| 199 |
bool use_limit = 5{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "use_limit,omitempty"]{{end}}; |
| 200 |
int32 limit = 6{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "limit,omitempty"]{{end}}; |
| 201 |
} |
| 202 |
|
| 203 |
message HistoryResult { |
| 204 |
repeated Publication publications = 1{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "publications"]{{end}}; |
| 205 |
string epoch = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "epoch"]{{end}}; |
| 206 |
uint64 offset = 3{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "offset"]{{end}}; |
| 207 |
} |
| 208 |
|
| 209 |
message PingRequest { |
| 210 |
} |
| 211 |
|
| 212 |
message PingResult { |
| 213 |
} |
| 214 |
|
| 215 |
message RPCRequest{ |
| 216 |
bytes data = 1{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 217 |
string method = 2{{if env.Getenv "GOGO"}} [(gogoproto.jsontag) = "method,omitempty"]{{end}}; |
| 218 |
} |
| 219 |
|
| 220 |
message RPCResult { |
| 221 |
bytes data = 1 {{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data,omitempty", (gogoproto.nullable) = false]{{end}}; |
| 222 |
} |
| 223 |
|
| 224 |
message SendRequest{ |
| 225 |
bytes data = 1{{if env.Getenv "GOGO"}} [(gogoproto.customtype) = "Raw", (gogoproto.jsontag) = "data", (gogoproto.nullable) = false]{{end}}; |
| 226 |
} |