workadventure/messages/messages.proto
David Négrier d3fa901691 Merge branch 'develop' of github.com:thecodingmachine/workadventure into feature/global-message
+ migrating to protobuf messages

# Conflicts:
#	back/src/App.ts
#	back/src/Controller/IoSocketController.ts
#	back/yarn.lock
#	front/src/Connection.ts
#	front/src/Phaser/Game/GameScene.ts
#	front/src/Phaser/Login/EnableCameraScene.ts
#	front/src/WebRtc/SimplePeer.ts
2020-10-01 14:11:34 +02:00

183 lines
3.7 KiB
Protocol Buffer

syntax = "proto3";
/*********** PARTIAL MESSAGES **************/
message PositionMessage {
int32 x = 1;
int32 y = 2;
enum Direction {
UP = 0;
RIGHT = 1;
DOWN = 2;
LEFT = 3;
}
Direction direction = 3;
bool moving = 4;
}
message PointMessage {
int32 x = 1;
int32 y = 2;
}
message ViewportMessage {
int32 left = 1;
int32 top = 2;
int32 right = 3;
int32 bottom = 4;
}
message SilentMessage {
bool silent = 1;
}
/*********** CLIENT TO SERVER MESSAGES *************/
message SetPlayerDetailsMessage {
string name = 1;
repeated string characterLayers = 2;
}
message JoinRoomMessage {
string roomId = 1;
PositionMessage position = 2;
ViewportMessage viewport = 3;
}
message UserMovesMessage {
PositionMessage position = 1;
ViewportMessage viewport = 2;
}
message WebRtcSignalToServerMessage {
int32 receiverId = 1;
string signal = 2;
}
message ClientToServerMessage {
oneof message {
JoinRoomMessage joinRoomMessage = 1;
UserMovesMessage userMovesMessage = 2;
SilentMessage silentMessage = 3;
ViewportMessage viewportMessage = 4;
ItemEventMessage itemEventMessage = 5;
SetPlayerDetailsMessage setPlayerDetailsMessage = 6;
WebRtcSignalToServerMessage webRtcSignalToServerMessage = 7;
WebRtcSignalToServerMessage webRtcScreenSharingSignalToServerMessage = 8;
PlayGlobalMessage playGlobalMessage = 9;
StopGlobalMessage stopGlobalMessage = 10;
}
}
/************ BI-DIRECTIONAL MESSAGES **************/
message ItemEventMessage {
int32 itemId = 1;
string event = 2;
string stateJson = 3;
string parametersJson = 4;
}
message PlayGlobalMessage {
string id = 1;
string type = 2;
string message = 3;
}
message StopGlobalMessage {
string id = 1;
}
/*********** SERVER TO CLIENT MESSAGES *************/
message UserMovedMessage {
int32 userId = 1;
PositionMessage position = 2;
}
message SubMessage {
oneof message {
UserMovedMessage userMovedMessage = 1;
GroupUpdateMessage groupUpdateMessage = 2;
GroupDeleteMessage groupDeleteMessage = 3;
UserJoinedMessage userJoinedMessage = 4;
UserLeftMessage userLeftMessage = 5;
ItemEventMessage itemEventMessage = 6;
}
}
message BatchMessage {
string event = 1;
repeated SubMessage payload = 2;
}
message GroupUpdateMessage {
int32 groupId = 1;
PointMessage position = 2;
}
message GroupDeleteMessage {
int32 groupId = 1;
}
message UserJoinedMessage {
int32 userId = 1;
string name = 2;
repeated string characterLayers = 3;
PositionMessage position = 4;
}
message UserLeftMessage {
int32 userId = 1;
}
message ErrorMessage {
string message = 1;
}
message SetUserIdMessage {
int32 userId = 1;
}
message ItemStateMessage {
int32 itemId = 1;
string stateJson = 2;
}
message RoomJoinedMessage {
repeated UserJoinedMessage user = 1;
repeated GroupUpdateMessage group = 2;
repeated ItemStateMessage item = 3;
}
message WebRtcStartMessage {
int32 userId = 1;
string name = 2;
bool initiator = 3;
}
message WebRtcDisconnectMessage {
int32 userId = 1;
}
message WebRtcSignalToClientMessage {
int32 userId = 1;
string signal = 2;
}
message ServerToClientMessage {
oneof message {
BatchMessage batchMessage = 1;
ErrorMessage errorMessage = 2;
RoomJoinedMessage roomJoinedMessage = 3;
SetUserIdMessage setUserIdMessage = 4; // TODO: merge this with RoomJoinedMessage ?
WebRtcStartMessage webRtcStartMessage = 5;
WebRtcSignalToClientMessage webRtcSignalToClientMessage = 6;
WebRtcSignalToClientMessage webRtcScreenSharingSignalToClientMessage = 7;
WebRtcDisconnectMessage webRtcDisconnectMessage = 8;
PlayGlobalMessage playGlobalMessage = 9;
StopGlobalMessage stopGlobalMessage = 10;
}
}