128 lines
2.5 KiB
Protocol Buffer
128 lines
2.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package centrifugal.centrifugo.unistream;
|
|
|
|
option go_package = "./;unistream";
|
|
|
|
service CentrifugoUniStream {
|
|
rpc Consume(ConnectRequest) returns (stream Push);
|
|
}
|
|
|
|
message ConnectRequest {
|
|
// Numeration is in sync with Centrifuge client protocol.
|
|
string token = 1;
|
|
bytes data = 2;
|
|
map<string, SubscribeRequest> subs = 3;
|
|
string name = 4;
|
|
string version = 5;
|
|
map<string, string> headers = 6;
|
|
}
|
|
|
|
message SubscribeRequest {
|
|
// Numeration is in sync with Centrifuge client protocol.
|
|
bool recover = 3;
|
|
reserved 4, 5;
|
|
string epoch = 6;
|
|
uint64 offset = 7;
|
|
}
|
|
|
|
// Push can be sent to a client as part of Reply in case of bidirectional transport or
|
|
// without additional wrapping in case of unidirectional transports.
|
|
// ProtocolVersion2 uses channel and one of the possible concrete push messages.
|
|
message Push {
|
|
reserved 1, 3;
|
|
string channel = 2;
|
|
|
|
// ProtocolVersion2 server can push one of the following fields to the client. We are
|
|
// not using oneof here due to JSON interoperability concerns.
|
|
Publication pub = 4;
|
|
Join join = 5;
|
|
Leave leave = 6;
|
|
Unsubscribe unsubscribe = 7;
|
|
Message message = 8;
|
|
Subscribe subscribe = 9;
|
|
Connect connect = 10;
|
|
Disconnect disconnect = 11;
|
|
Refresh refresh = 12;
|
|
}
|
|
|
|
message ClientInfo {
|
|
string user = 1;
|
|
string client = 2;
|
|
bytes conn_info = 3;
|
|
bytes chan_info = 4;
|
|
}
|
|
|
|
message Publication {
|
|
reserved 1, 2, 3;
|
|
bytes data = 4;
|
|
ClientInfo info = 5;
|
|
uint64 offset = 6;
|
|
map<string, string> tags = 7;
|
|
}
|
|
|
|
message Join {
|
|
ClientInfo info = 1;
|
|
}
|
|
|
|
message Leave {
|
|
ClientInfo info = 1;
|
|
}
|
|
|
|
message Unsubscribe {
|
|
reserved 1;
|
|
uint32 code = 2;
|
|
string reason = 3;
|
|
}
|
|
|
|
message Subscribe {
|
|
bool recoverable = 1;
|
|
reserved 2, 3;
|
|
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;
|
|
uint32 ping = 7;
|
|
bool pong = 8;
|
|
string session = 9;
|
|
string node = 10;
|
|
}
|
|
|
|
message Disconnect {
|
|
uint32 code = 1;
|
|
string reason = 2;
|
|
bool reconnect = 3;
|
|
}
|
|
|
|
message Refresh {
|
|
bool expires = 1;
|
|
uint32 ttl = 2;
|
|
}
|
|
|
|
message SubscribeResult {
|
|
bool expires = 1;
|
|
uint32 ttl = 2;
|
|
bool recoverable = 3;
|
|
reserved 4, 5;
|
|
string epoch = 6;
|
|
repeated Publication publications = 7;
|
|
bool recovered = 8;
|
|
uint64 offset = 9;
|
|
bool positioned = 10;
|
|
bytes data = 11;
|
|
bool was_recovering = 12;
|
|
}
|