websocket.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 FindOnlinePersonAll (google.protobuf.Empty) returns (FindOnlinePersonReply);
  14. // 查询在线人数
  15. rpc FindOnlineCanMatchingPerson (google.protobuf.Empty) returns (FindOnlineCanMatchingPersonReply);
  16. // 发送消息
  17. rpc SendMsg (SendMsgRequest) returns (SendMsgReply){};
  18. // 更新工作状态
  19. rpc UpdateWorkingStatus (UpdateWorkingStatusRequest) returns (google.protobuf.Empty){};
  20. // 更新权重
  21. rpc UpdateWeight (UpdateWeightRequest) returns (google.protobuf.Empty){};
  22. // 更新每日被匹配数
  23. rpc UpdateTodayMatchedNum (UpdateTodayMatchedNumRequest) returns (google.protobuf.Empty){};
  24. // 检查是否在线
  25. rpc CheckIsOnline (CheckIsOnlineRequest) returns (CheckIsOnlineReply){};
  26. // 检查是否在线
  27. rpc CheckIsOnlineByIDs (CheckIsOnlineByIDsParam) returns (CheckIsOnlineByIDsParam){};
  28. // 查询在线多少人
  29. rpc FindOnlinePersonNum (google.protobuf.Empty) returns (OnlinePersonReply);
  30. // 定时检查在线超过一小时的用户并将其下线
  31. rpc CronCheckConnectTime (google.protobuf.Empty) returns (google.protobuf.Empty);
  32. }
  33. message FindOnlineCanMatchingPersonReply{
  34. repeated FindOnlineCanMatchingPersonInfo list = 1;
  35. }
  36. message FindOnlineCanMatchingPersonInfo{
  37. int64 todayMatchedNum = 1;// 今日被匹配数
  38. string personId = 2;
  39. int64 weight = 3;// 权重
  40. string workingStatus = 4;// 工作状态
  41. int64 sex = 5;// 性别
  42. int64 age = 6;// 年龄
  43. string province = 7;// 省
  44. string city = 8;// 市
  45. string lastLoginTime = 9;
  46. int64 connectTime = 10;
  47. }
  48. message OnlinePersonReply{
  49. int64 userManNum = 1; // 男用户在线数
  50. int64 userWomanNum = 2; // 女用户在线数
  51. int64 userOtherNum = 3; // 未填写性别的用户在线数
  52. }
  53. message CheckIsOnlineRequest{
  54. string userId = 1;// 身份ID
  55. }
  56. message CheckIsOnlineByIDsParam{
  57. repeated string userIds = 1;// 身份ID
  58. }
  59. message CheckIsOnlineReply{
  60. bool isOnline = 1;// 是否在线
  61. }
  62. message UpdateWorkingStatusRequest{
  63. string id = 1;
  64. string workingStatus = 2;
  65. }
  66. message UpdateWeightRequest{
  67. string id = 1;
  68. int64 weight = 2;
  69. }
  70. message UpdateTodayMatchedNumRequest{
  71. string id = 1;
  72. int64 todayMatchedNum = 2;
  73. }
  74. message MessageInfo{
  75. int64 roomId = 1; // 房间ID
  76. string message = 2;// 发送的消息
  77. string msgType = 3;// 消息类型
  78. }
  79. message SendMsgRequest{
  80. string id = 1;
  81. string method = 2;
  82. bytes data = 3;
  83. int32 code = 4;
  84. string message = 5;
  85. string websocketTag = 6;
  86. bool isSelf = 7;// 是否是给自己发送的
  87. int64 messageId = 8;// 消息id
  88. }
  89. message SendMsgReply{
  90. }
  91. message FindOnlinePersonReply{
  92. repeated OnlinePersonInfo list = 1;
  93. }
  94. message OnlinePersonInfo{
  95. string personId = 2;
  96. int64 weight = 3;// 权重
  97. string workingStatus = 4;// 工作状态
  98. int64 sex = 5;// 性别
  99. string lastLoginTime = 6;
  100. int64 connectTime = 7;
  101. }