messages.proto 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. syntax = "proto3";
  2. /*********** PARTIAL MESSAGES **************/
  3. message PositionMessage {
  4. int32 x = 1;
  5. int32 y = 2;
  6. enum Direction {
  7. UP = 0;
  8. RIGHT = 1;
  9. DOWN = 2;
  10. LEFT = 3;
  11. }
  12. Direction direction = 3;
  13. bool moving = 4;
  14. }
  15. message PointMessage {
  16. int32 x = 1;
  17. int32 y = 2;
  18. }
  19. message ViewportMessage {
  20. int32 left = 1;
  21. int32 top = 2;
  22. int32 right = 3;
  23. int32 bottom = 4;
  24. }
  25. message SilentMessage {
  26. bool silent = 1;
  27. }
  28. message CharacterLayerMessage {
  29. string url = 1;
  30. string name = 2;
  31. }
  32. message Companion {
  33. string name = 1;
  34. }
  35. /*********** CLIENT TO SERVER MESSAGES *************/
  36. message PingMessage {
  37. }
  38. message SetPlayerDetailsMessage {
  39. string name = 1;
  40. repeated string characterLayers = 2;
  41. }
  42. message UserMovesMessage {
  43. PositionMessage position = 1;
  44. ViewportMessage viewport = 2;
  45. }
  46. message WebRtcSignalToServerMessage {
  47. int32 receiverId = 1;
  48. string signal = 2;
  49. }
  50. message ReportPlayerMessage {
  51. int32 reportedUserId = 1;
  52. string reportComment = 2;
  53. }
  54. message QueryJitsiJwtMessage {
  55. string jitsiRoom = 1;
  56. string tag = 2; // FIXME: rather than reading the tag from the query, we should read it from the current map!
  57. }
  58. message ClientToServerMessage {
  59. oneof message {
  60. UserMovesMessage userMovesMessage = 2;
  61. SilentMessage silentMessage = 3;
  62. ViewportMessage viewportMessage = 4;
  63. ItemEventMessage itemEventMessage = 5;
  64. SetPlayerDetailsMessage setPlayerDetailsMessage = 6;
  65. WebRtcSignalToServerMessage webRtcSignalToServerMessage = 7;
  66. WebRtcSignalToServerMessage webRtcScreenSharingSignalToServerMessage = 8;
  67. PlayGlobalMessage playGlobalMessage = 9;
  68. StopGlobalMessage stopGlobalMessage = 10;
  69. ReportPlayerMessage reportPlayerMessage = 11;
  70. QueryJitsiJwtMessage queryJitsiJwtMessage = 12;
  71. }
  72. }
  73. /************ BI-DIRECTIONAL MESSAGES **************/
  74. message ItemEventMessage {
  75. int32 itemId = 1;
  76. string event = 2;
  77. string stateJson = 3;
  78. string parametersJson = 4;
  79. }
  80. message PlayGlobalMessage {
  81. string id = 1;
  82. string type = 2;
  83. string message = 3;
  84. }
  85. message StopGlobalMessage {
  86. string id = 1;
  87. }
  88. /*********** SERVER TO CLIENT MESSAGES *************/
  89. message UserMovedMessage {
  90. int32 userId = 1;
  91. PositionMessage position = 2;
  92. }
  93. message SubMessage {
  94. oneof message {
  95. UserMovedMessage userMovedMessage = 1;
  96. GroupUpdateMessage groupUpdateMessage = 2;
  97. GroupDeleteMessage groupDeleteMessage = 3;
  98. UserJoinedMessage userJoinedMessage = 4;
  99. UserLeftMessage userLeftMessage = 5;
  100. ItemEventMessage itemEventMessage = 6;
  101. }
  102. }
  103. message BatchMessage {
  104. string event = 1;
  105. repeated SubMessage payload = 2;
  106. }
  107. message GroupUpdateMessage {
  108. int32 groupId = 1;
  109. PointMessage position = 2;
  110. int32 groupSize = 3;
  111. }
  112. message GroupDeleteMessage {
  113. int32 groupId = 1;
  114. }
  115. message UserJoinedMessage {
  116. int32 userId = 1;
  117. string name = 2;
  118. repeated CharacterLayerMessage characterLayers = 3;
  119. PositionMessage position = 4;
  120. Companion companion = 5;
  121. }
  122. message UserLeftMessage {
  123. int32 userId = 1;
  124. }
  125. message ErrorMessage {
  126. string message = 1;
  127. }
  128. message ItemStateMessage {
  129. int32 itemId = 1;
  130. string stateJson = 2;
  131. }
  132. message RoomJoinedMessage {
  133. //repeated UserJoinedMessage user = 1;
  134. //repeated GroupUpdateMessage group = 2;
  135. repeated ItemStateMessage item = 3;
  136. int32 currentUserId = 4;
  137. repeated string tag = 5;
  138. }
  139. message WebRtcStartMessage {
  140. int32 userId = 1;
  141. string name = 2;
  142. bool initiator = 3;
  143. string webrtcUserName = 4;
  144. string webrtcPassword = 5;
  145. }
  146. message WebRtcDisconnectMessage {
  147. int32 userId = 1;
  148. }
  149. message WebRtcSignalToClientMessage {
  150. int32 userId = 1;
  151. string signal = 2;
  152. string webrtcUserName = 4;
  153. string webrtcPassword = 5;
  154. }
  155. message TeleportMessageMessage{
  156. string map = 1;
  157. }
  158. message SendJitsiJwtMessage {
  159. string jitsiRoom = 1;
  160. string jwt = 2;
  161. }
  162. message SendUserMessage{
  163. string type = 1;
  164. string message = 2;
  165. }
  166. message WorldFullWarningMessage{
  167. }
  168. message WorldFullWarningToRoomMessage{
  169. string roomId = 1;
  170. }
  171. message RefreshRoomPromptMessage{
  172. string roomId = 1;
  173. }
  174. message RefreshRoomMessage{
  175. string roomId = 1;
  176. int32 versionNumber = 2;
  177. }
  178. message WorldFullMessage{
  179. }
  180. message BanUserMessage{
  181. string type = 1;
  182. string message = 2;
  183. }
  184. message ServerToClientMessage {
  185. oneof message {
  186. BatchMessage batchMessage = 1;
  187. ErrorMessage errorMessage = 2;
  188. RoomJoinedMessage roomJoinedMessage = 3;
  189. WebRtcStartMessage webRtcStartMessage = 4;
  190. WebRtcSignalToClientMessage webRtcSignalToClientMessage = 5;
  191. WebRtcSignalToClientMessage webRtcScreenSharingSignalToClientMessage = 6;
  192. WebRtcDisconnectMessage webRtcDisconnectMessage = 7;
  193. PlayGlobalMessage playGlobalMessage = 8;
  194. StopGlobalMessage stopGlobalMessage = 9;
  195. TeleportMessageMessage teleportMessageMessage = 10;
  196. SendJitsiJwtMessage sendJitsiJwtMessage = 11;
  197. SendUserMessage sendUserMessage = 12;
  198. BanUserMessage banUserMessage = 13;
  199. AdminRoomMessage adminRoomMessage = 14;
  200. WorldFullWarningMessage worldFullWarningMessage = 15;
  201. WorldFullMessage worldFullMessage = 16;
  202. RefreshRoomMessage refreshRoomMessage = 17;
  203. }
  204. }
  205. /************************** SERVICES **************************/
  206. message JoinRoomMessage {
  207. PositionMessage positionMessage = 1;
  208. string name = 2;
  209. repeated CharacterLayerMessage characterLayer = 3;
  210. string userUuid = 4;
  211. string roomId = 5;
  212. repeated string tag = 6;
  213. string IPAddress = 7;
  214. Companion companion = 8;
  215. }
  216. message UserJoinedZoneMessage {
  217. int32 userId = 1;
  218. string name = 2;
  219. repeated CharacterLayerMessage characterLayers = 3;
  220. PositionMessage position = 4;
  221. Zone fromZone = 5;
  222. Companion companion = 6;
  223. }
  224. message UserLeftZoneMessage {
  225. int32 userId = 1;
  226. Zone toZone = 2;
  227. }
  228. message GroupUpdateZoneMessage {
  229. int32 groupId = 1;
  230. PointMessage position = 2;
  231. int32 groupSize = 3;
  232. Zone fromZone = 4;
  233. }
  234. message GroupLeftZoneMessage {
  235. int32 groupId = 1;
  236. Zone toZone = 2;
  237. }
  238. message Zone {
  239. int32 x = 1;
  240. int32 y = 2;
  241. }
  242. message ZoneMessage {
  243. string roomId = 1;
  244. int32 x = 2;
  245. int32 y = 3;
  246. }
  247. message PusherToBackMessage {
  248. oneof message {
  249. JoinRoomMessage joinRoomMessage = 1;
  250. UserMovesMessage userMovesMessage = 2;
  251. SilentMessage silentMessage = 3;
  252. ItemEventMessage itemEventMessage = 4;
  253. SetPlayerDetailsMessage setPlayerDetailsMessage = 5;
  254. WebRtcSignalToServerMessage webRtcSignalToServerMessage = 6;
  255. WebRtcSignalToServerMessage webRtcScreenSharingSignalToServerMessage = 7;
  256. PlayGlobalMessage playGlobalMessage = 8;
  257. StopGlobalMessage stopGlobalMessage = 9;
  258. ReportPlayerMessage reportPlayerMessage = 10;
  259. QueryJitsiJwtMessage queryJitsiJwtMessage = 11;
  260. SendUserMessage sendUserMessage = 12;
  261. BanUserMessage banUserMessage = 13;
  262. }
  263. }
  264. message BatchToPusherMessage {
  265. repeated SubToPusherMessage payload = 2;
  266. }
  267. message SubToPusherMessage {
  268. oneof message {
  269. UserJoinedZoneMessage userJoinedZoneMessage = 1;
  270. GroupUpdateZoneMessage groupUpdateZoneMessage = 2;
  271. UserMovedMessage userMovedMessage = 3;
  272. GroupLeftZoneMessage groupLeftZoneMessage = 4;
  273. UserLeftZoneMessage userLeftZoneMessage = 5;
  274. ItemEventMessage itemEventMessage = 6;
  275. SendUserMessage sendUserMessage = 7;
  276. BanUserMessage banUserMessage = 8;
  277. }
  278. }
  279. /*message BatchToAdminPusherMessage {
  280. repeated SubToAdminPusherMessage payload = 2;
  281. }*/
  282. /*message SubToAdminPusherMessage {
  283. oneof message {
  284. string userUuidJoinedRoom = 1;
  285. string userUuidLeftRoom = 2;
  286. }
  287. }
  288. message ServerToAdminClientMessage {
  289. repeated SubToAdminPusherMessage payload = 2;
  290. }*/
  291. message UserJoinedRoomMessage {
  292. string uuid = 1;
  293. string ipAddress = 2;
  294. string name = 3;
  295. }
  296. message UserLeftRoomMessage {
  297. string uuid = 1;
  298. }
  299. message ServerToAdminClientMessage {
  300. oneof message {
  301. UserJoinedRoomMessage userJoinedRoom = 1;
  302. UserLeftRoomMessage userLeftRoom = 2;
  303. }
  304. }
  305. message AdminPusherToBackMessage {
  306. oneof message {
  307. string subscribeToRoom = 1;
  308. // TODO ban, unban
  309. }
  310. }
  311. // A message sent by an administrator to a recipient
  312. message AdminMessage {
  313. string message = 1;
  314. string recipientUuid = 2;
  315. string roomId = 3;
  316. string type = 4;
  317. }
  318. // A message sent by an administrator to everyone in a specific room
  319. message AdminRoomMessage {
  320. string message = 1;
  321. string roomId = 2;
  322. }
  323. // A message sent by an administrator to absolutely everybody
  324. message AdminGlobalMessage {
  325. string message = 1;
  326. }
  327. message BanMessage {
  328. string recipientUuid = 1;
  329. string roomId = 2;
  330. string type = 3;
  331. string message = 4;
  332. }
  333. message EmptyMessage {
  334. }
  335. service RoomManager {
  336. rpc joinRoom(stream PusherToBackMessage) returns (stream ServerToClientMessage);
  337. rpc listenZone(ZoneMessage) returns (stream BatchToPusherMessage);
  338. rpc adminRoom(stream AdminPusherToBackMessage) returns (stream ServerToAdminClientMessage);
  339. rpc sendAdminMessage(AdminMessage) returns (EmptyMessage);
  340. rpc sendGlobalAdminMessage(AdminGlobalMessage) returns (EmptyMessage);
  341. rpc ban(BanMessage) returns (EmptyMessage);
  342. rpc sendAdminMessageToRoom(AdminRoomMessage) returns (EmptyMessage);
  343. rpc sendWorldFullWarningToRoom(WorldFullWarningToRoomMessage) returns (EmptyMessage);
  344. rpc sendRefreshRoomPrompt(RefreshRoomPromptMessage) returns (EmptyMessage);
  345. }