websocket.proto 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 partnerManNum = 3; // 男接待员在线数
  27. int64 partnerWomanNum = 4; // 女接待员在线数
  28. int64 userOtherNum = 5; // 未填写性别的用户在线数
  29. int64 partnerOtherNum = 6; // 未填写性别的接待员在线数
  30. }
  31. message CheckIsOnlineRequest{
  32. string userId = 1;// 身份ID
  33. }
  34. message CheckIsOnlineReply{
  35. bool isOnline = 1;// 是否在线
  36. }
  37. message UpdateWorkingStatusRequest{
  38. string id = 1;
  39. string workingStatus = 2;
  40. }
  41. message UpdateWeightRequest{
  42. string id = 1;
  43. int64 weight = 2;
  44. }
  45. message MessageInfo{
  46. int64 roomId = 1; // 房间ID
  47. string message = 2;// 发送的消息
  48. string msgType = 3;// 消息类型
  49. }
  50. message SendMsgRequest{
  51. string id = 1;
  52. string method = 2;
  53. bytes data = 3;
  54. int32 code = 4;
  55. string message = 5;
  56. string websocketTag = 6;
  57. }
  58. message SendMsgReply{
  59. }
  60. message FindOnlinePersonReply{
  61. repeated OnlinePersonInfo list = 1;
  62. }
  63. message OnlinePersonInfo{
  64. string personType = 1;
  65. string personId = 2;
  66. int64 weight = 3;// 权重
  67. string workingStatus = 4;// 工作状态
  68. int64 sex = 5;// 性别
  69. }