78 lines
1.7 KiB
Protocol Buffer
78 lines
1.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package gatewayv1;
|
|
|
|
option go_package = "./gatewayv1;gatewayv1";
|
|
|
|
service SSEService {
|
|
// 推送消息
|
|
rpc Push(PushRequest) returns (PushResponse);
|
|
// 广播消息
|
|
rpc Broadcast(BroadcastRequest) returns (BroadcastResponse);
|
|
// 获取注册时间
|
|
rpc GetRegisterTime(GetRegisterTimeRequest) returns (GetRegisterTimeResponse);
|
|
// 获取在线情况
|
|
rpc GetOnlineStatus(GetOnlineStatusRequest) returns (GetOnlineStatusResponse);
|
|
// GetToken 获取token
|
|
rpc GetToken(GetTokenRequest) returns (GetTokenResponse);
|
|
}
|
|
|
|
message GetTokenRequest {
|
|
// 系统标识,请联系维护者获取名称,以免重复
|
|
string from_system = 1;
|
|
// 标签
|
|
string tag = 2;
|
|
// 用户ID
|
|
string uid = 3;
|
|
// token 过期的时间戳,(0表示不过期, 仅限测试时使用,否则为永久有效,存在安全泄漏问题)
|
|
int64 expire_at = 4;
|
|
}
|
|
|
|
message GetTokenResponse {
|
|
// token
|
|
string token = 1;
|
|
}
|
|
|
|
message GetOnlineStatusRequest {
|
|
string fromSystem = 1;
|
|
string tag = 2;
|
|
}
|
|
|
|
message GetOnlineStatusResponse {
|
|
int32 onlineCount = 1;
|
|
}
|
|
|
|
// 推送消息
|
|
message PushRequest {
|
|
string fromSystem = 1;
|
|
string uid = 2;
|
|
string tag = 3;
|
|
string data = 4;
|
|
}
|
|
|
|
// 推送消息响应
|
|
message PushResponse {
|
|
}
|
|
|
|
// 广播消息
|
|
message BroadcastRequest {
|
|
string fromSystem = 1;
|
|
string tag = 2;
|
|
string data = 3;
|
|
}
|
|
|
|
// 广播消息响应
|
|
message BroadcastResponse {
|
|
}
|
|
|
|
// 获取注册时间
|
|
message GetRegisterTimeRequest {
|
|
string fromSystem = 1;
|
|
string tag = 2;
|
|
string uid = 3;
|
|
}
|
|
|
|
// 获取注册时间响应
|
|
message GetRegisterTimeResponse {
|
|
int32 registerTime = 1;
|
|
} |