2023-05-05 01:57:10 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2023-05-08 20:14:24 +00:00
|
|
|
package chat;
|
|
|
|
|
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
|
2023-05-05 01:57:10 +00:00
|
|
|
message ChatMessage {
|
2023-05-09 09:31:46 +00:00
|
|
|
string messageId = 1;
|
|
|
|
string fromUserId = 2;
|
|
|
|
string toUserId = 3;
|
|
|
|
string toRoomId = 4;
|
|
|
|
string content = 5;
|
2023-05-05 01:57:10 +00:00
|
|
|
}
|
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
message Room {
|
|
|
|
string name = 1;
|
|
|
|
}
|
2023-05-09 07:15:01 +00:00
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
message UserList { repeated User users = 1; }
|
2023-05-09 08:14:54 +00:00
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
message RoomList {repeated Room rooms = 1;}
|
2023-05-08 20:14:24 +00:00
|
|
|
|
2023-05-09 07:15:01 +00:00
|
|
|
message User { string username = 1; }
|
2023-05-08 20:14:24 +00:00
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
// RPC Messages
|
|
|
|
|
2023-05-09 09:43:47 +00:00
|
|
|
message RoomActionResponse {}
|
2023-05-08 20:14:24 +00:00
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
message RoomAction {
|
|
|
|
string roomId = 1;
|
|
|
|
string userId = 2;
|
|
|
|
string action = 3;
|
|
|
|
}
|
|
|
|
|
2023-05-09 07:15:01 +00:00
|
|
|
service Chat {
|
2023-05-09 09:31:46 +00:00
|
|
|
// Rooms
|
|
|
|
rpc roomAction(RoomAction) returns (JoinResponse) {}
|
|
|
|
|
|
|
|
// Messages
|
2023-05-09 07:15:01 +00:00
|
|
|
rpc sendMsg(ChatMessage) returns (google.protobuf.Empty) {}
|
2023-05-09 09:31:46 +00:00
|
|
|
rpc receiveMsgs(google.protobuf.Empty) returns (stream ChatMessage) {}
|
2023-05-09 08:14:54 +00:00
|
|
|
|
2023-05-09 09:31:46 +00:00
|
|
|
// List
|
2023-05-09 08:14:54 +00:00
|
|
|
rpc listRooms(google.protobuf.Empty) returns (RoomList) {}
|
2023-05-09 07:15:01 +00:00
|
|
|
rpc getAllUsers(google.protobuf.Empty) returns (UserList) {}
|
2023-05-09 09:31:46 +00:00
|
|
|
}
|