Files
services/streams/proto/streams.proto
2021-02-08 14:42:47 +00:00

38 lines
1.0 KiB
Protocol Buffer

syntax = "proto3";
package streams;
option go_package = "github.com/micro/services/streams/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;
}