Files
services/streams/proto/streams.proto
2021-03-24 08:40:27 +00:00

39 lines
998 B
Protocol Buffer

syntax = "proto3";
package streams;
option go_package = "./proto;streams";
import "google/protobuf/timestamp.proto";
service Streams {
rpc Publish(Message) returns (PublishResponse) {}
rpc Subscribe(SubscribeRequest) returns (stream Message) {}
rpc Token(TokenRequest) returns (TokenResponse) {}
}
message PublishResponse {}
message Message {
string topic = 1;
string message = 2;
google.protobuf.Timestamp sent_at = 3;
}
message SubscribeRequest {
// topic the user wishes to subscribe to, required
string topic = 1;
// tokens should be provided if the user is not proving an API key on the request (e.g. in cases
// where the stream is being consumed directly from the frontend via websockets). tokens can be
// generated using the Token RPC
string token = 2;
}
message TokenRequest {
// the topic the token should be restricted to, if no topic is required the token can be used to
// subscribe to any topic
string topic = 1;
}
message TokenResponse {
string token = 1;
}