49 lines
967 B
Protocol Buffer
49 lines
967 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package chat;
|
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
message ChatMessage {
|
|
string messageId = 1;
|
|
string fromUserId = 2;
|
|
string toUserId = 3;
|
|
string toRoomId = 4;
|
|
string content = 5;
|
|
}
|
|
|
|
message Room { string name = 1; }
|
|
|
|
message UserList { repeated User users = 1; }
|
|
|
|
message RoomList { repeated Room rooms = 1; }
|
|
|
|
message User {
|
|
string userId = 1;
|
|
string username = 2;
|
|
}
|
|
|
|
// RPC Messages
|
|
|
|
message ReceiveMsgsRequest { string userId = 1; }
|
|
|
|
message RoomActionResponse {}
|
|
|
|
message RoomAction {
|
|
string roomId = 1;
|
|
string userId = 2;
|
|
string action = 3;
|
|
}
|
|
|
|
service Chat {
|
|
// Rooms
|
|
rpc roomAction(RoomAction) returns (google.protobuf.Empty) {}
|
|
|
|
// Messages
|
|
rpc sendMsg(ChatMessage) returns (google.protobuf.Empty) {}
|
|
rpc receiveMsgs(ReceiveMsgsRequest) returns (stream ChatMessage) {}
|
|
|
|
// List
|
|
rpc listRooms(google.protobuf.Empty) returns (RoomList) {}
|
|
rpc getAllUsers(google.protobuf.Empty) returns (UserList) {}
|
|
}
|