46 lines
880 B
Protocol Buffer
46 lines
880 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 username = 1; }
|
|
|
|
// RPC Messages
|
|
|
|
message JoinResponse {}
|
|
|
|
message RoomAction {
|
|
string roomId = 1;
|
|
string userId = 2;
|
|
string action = 3;
|
|
}
|
|
|
|
service Chat {
|
|
// Rooms
|
|
rpc roomAction(RoomAction) returns (JoinResponse) {}
|
|
|
|
// Messages
|
|
rpc sendMsg(ChatMessage) returns (google.protobuf.Empty) {}
|
|
rpc receiveMsgs(google.protobuf.Empty) returns (stream ChatMessage) {}
|
|
|
|
// List
|
|
rpc listRooms(google.protobuf.Empty) returns (RoomList) {}
|
|
rpc getAllUsers(google.protobuf.Empty) returns (UserList) {}
|
|
} |