40 lines
857 B
Protocol Buffer
40 lines
857 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package chat;
|
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
message ChatMessage {
|
|
string from = 1;
|
|
string msg = 2;
|
|
string time = 3;
|
|
}
|
|
|
|
message Channel {}
|
|
|
|
message UserList {}
|
|
|
|
message User { string username = 1; }
|
|
|
|
message JoinResponse {}
|
|
|
|
service Chat {
|
|
rpc join(User) returns (JoinResponse) {}
|
|
rpc sendMsg(ChatMessage) returns (google.protobuf.Empty) {}
|
|
rpc receiveMsg(google.protobuf.Empty) returns (stream ChatMessage) {}
|
|
rpc getAllUsers(google.protobuf.Empty) returns (UserList) {}
|
|
}
|
|
|
|
// Hello world shit
|
|
|
|
// The greeting service definition.
|
|
service Greeter {
|
|
// Sends a greeting
|
|
rpc SayHello(HelloRequest) returns (HelloReply) {}
|
|
}
|
|
|
|
// The request message containing the user's name.
|
|
message HelloRequest { string name = 1; }
|
|
|
|
// The response message containing the greetings
|
|
message HelloReply { string message = 1; }
|