mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 15:25:19 +00:00
Streams (#68)
This commit is contained in:
38
streams/proto/streams.proto
Normal file
38
streams/proto/streams.proto
Normal file
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user