websocket.proto 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. syntax = "proto3";
  2. package api.websocket;
  3. //import "google/api/annotations.proto";
  4. //import "google/protobuf/struct.proto";
  5. import "google/protobuf/empty.proto";
  6. option go_package = "git.ikuban.com/server/pw-protobuf/api/websocket;websocket";
  7. option java_multiple_files = true;
  8. option java_package = "api.websocket";
  9. service Websocket {
  10. // 查询在线人数
  11. rpc FindOnlinePerson (google.protobuf.Empty) returns (FindOnlinePersonReply);
  12. // 发送消息
  13. rpc SendMsg (SendMsgRequest) returns (SendMsgReply){};
  14. // 更新工作状态
  15. rpc UpdateWorkingStatus (UpdateWorkingStatusRequest) returns (google.protobuf.Empty){};
  16. // 更新权重
  17. rpc UpdateWeight (UpdateWeightRequest) returns (google.protobuf.Empty){};
  18. // 检查是否在线
  19. rpc CheckIsOnline (CheckIsOnlineRequest) returns (CheckIsOnlineReply){};
  20. // 查询在线多少人
  21. rpc FindOnlinePersonNum (google.protobuf.Empty) returns (OnlinePersonReply);
  22. }
  23. message OnlinePersonReply{
  24. int64 userManNum = 1; // 男用户在线数
  25. int64 userWomanNum = 2; // 女用户在线数
  26. int64 userOtherNum = 3; // 未填写性别的用户在线数
  27. }
  28. message CheckIsOnlineRequest{
  29. string userId = 1;// 身份ID
  30. }
  31. message CheckIsOnlineReply{
  32. bool isOnline = 1;// 是否在线
  33. }
  34. message UpdateWorkingStatusRequest{
  35. string id = 1;
  36. string workingStatus = 2;
  37. }
  38. message UpdateWeightRequest{
  39. string id = 1;
  40. int64 weight = 2;
  41. }
  42. message MessageInfo{
  43. int64 roomId = 1; // 房间ID
  44. string message = 2;// 发送的消息
  45. string msgType = 3;// 消息类型
  46. }
  47. message SendMsgRequest{
  48. string id = 1;
  49. string method = 2;
  50. bytes data = 3;
  51. int32 code = 4;
  52. string message = 5;
  53. string websocketTag = 6;
  54. }
  55. message SendMsgReply{
  56. }
  57. message FindOnlinePersonReply{
  58. repeated OnlinePersonInfo list = 1;
  59. }
  60. message OnlinePersonInfo{
  61. string personId = 2;
  62. int64 weight = 3;// 权重
  63. string workingStatus = 4;// 工作状态
  64. int64 sex = 5;// 性别
  65. }