更新大量【proto定义】并勘误
This commit is contained in:
96
grpc_api/bilibili/broadcast/v1/broadcast.proto
Normal file
96
grpc_api/bilibili/broadcast/v1/broadcast.proto
Normal file
@@ -0,0 +1,96 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "bilibili/rpc/status.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// broadcast操作,对应每个target_path
|
||||
service Broadcast {
|
||||
// 用户鉴权
|
||||
rpc Auth(AuthReq) returns (AuthResp);
|
||||
// 心跳保活:成功心跳为4分45秒,重试心跳为30s,三次收不到进行重连(不超过5分45)
|
||||
rpc Heartbeat(HeartbeatReq) returns (HeartbeatResp);
|
||||
// 订阅target_path
|
||||
rpc Subscribe(TargetPath) returns (google.protobuf.Empty);
|
||||
// 取消订阅target_path
|
||||
rpc Unsubscribe(TargetPath) returns (google.protobuf.Empty);
|
||||
// 消息回执
|
||||
rpc MessageAck(MessageAckReq) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
||||
// broadcast连接隧道
|
||||
service BroadcastTunnel {
|
||||
// 创建双向stream连接隧道
|
||||
rpc CreateTunnel(stream BroadcastFrame) returns (stream BroadcastFrame);
|
||||
}
|
||||
|
||||
// 鉴权请求,通过authorization验证绑定用户mid
|
||||
message AuthReq {
|
||||
// 冷启动id,算法uuid,重新起启会变
|
||||
string guid = 1;
|
||||
// 连接id,算法uuid,重连会变
|
||||
string conn_id = 2;
|
||||
// 最后收到的消息id,用于过虑重连后获取未读的消息
|
||||
int64 last_msg_id = 3;
|
||||
}
|
||||
// 鉴权返回
|
||||
message AuthResp {}
|
||||
|
||||
// 心跳请求
|
||||
message HeartbeatReq{}
|
||||
// 心跳返回
|
||||
message HeartbeatResp{}
|
||||
|
||||
// target_path
|
||||
message TargetPath {
|
||||
// 需要订阅的target_paths
|
||||
repeated string target_paths = 1;
|
||||
}
|
||||
|
||||
// 消息回执
|
||||
message MessageAckReq {
|
||||
// 消息id
|
||||
int64 ack_id = 1;
|
||||
// ack来源,由业务指定用于埋点跟踪
|
||||
string ack_origin = 2;
|
||||
// 消息对应的target_path,方便业务区分和监控统计
|
||||
string target_path = 3;
|
||||
}
|
||||
|
||||
// message_id:
|
||||
// client: 本次连接唯一的消息id,可用于回执
|
||||
// server: 唯一消息id,可用于上报或者回执
|
||||
// sequence:
|
||||
// client: 客户端应该每次请求时frame seq++,会返回对应的对称req/resp
|
||||
// server: 服务端下行消息,只会返回默认值:0
|
||||
message FrameOption {
|
||||
// 消息id
|
||||
int64 message_id = 1;
|
||||
// frame序号
|
||||
int64 sequence = 2;
|
||||
// 是否进行消息回执(发出MessageAckReq)
|
||||
// downstream 上只有服务端设置为true,客户端响应
|
||||
// upstream 上只有客户端设置为true,服务端响应
|
||||
// 响应帧禁止设置is_ack,协议上禁止循环
|
||||
// 通常只有业务帧才可能设置is_ack, 因为协议栈(例如心跳、鉴权)另有响应约定
|
||||
bool is_ack = 3;
|
||||
// 业务状态码
|
||||
bilibili.rpc.Status status = 4;
|
||||
// 业务ack来源, 仅downstream时候由服务端填写.
|
||||
string ack_origin = 5;
|
||||
}
|
||||
|
||||
// target_path:
|
||||
// "/" Service-Name "/" {method name} 参考 gRPC Request Path
|
||||
message BroadcastFrame {
|
||||
// 请求消息信息
|
||||
FrameOption options = 1;
|
||||
// 业务target_path
|
||||
string target_path = 2;
|
||||
// 业务pb内容
|
||||
google.protobuf.Any body = 3;
|
||||
}
|
||||
|
||||
|
||||
19
grpc_api/bilibili/broadcast/v1/laser.proto
Normal file
19
grpc_api/bilibili/broadcast/v1/laser.proto
Normal file
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// Laser
|
||||
service Laser {
|
||||
// 监听上报事件
|
||||
rpc WatchLogUploadEvent(google.protobuf.Empty) returns (stream LaserLogUploadResp);
|
||||
}
|
||||
|
||||
// 服务端下发日志上报事件
|
||||
message LaserLogUploadResp {
|
||||
// 任务id
|
||||
int64 taskid = 1;
|
||||
// 下发时间
|
||||
string date = 2;
|
||||
}
|
||||
13
grpc_api/bilibili/broadcast/v1/mod.proto
Normal file
13
grpc_api/bilibili/broadcast/v1/mod.proto
Normal file
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
message ModResourceResp {}
|
||||
|
||||
// ModManager
|
||||
service ModManager {
|
||||
//
|
||||
rpc WatchResource(google.protobuf.Empty) returns (stream ModResourceResp);
|
||||
}
|
||||
126
grpc_api/bilibili/broadcast/v1/push.proto
Normal file
126
grpc_api/bilibili/broadcast/v1/push.proto
Normal file
@@ -0,0 +1,126 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// Push
|
||||
service Push {
|
||||
rpc WatchMessage(google.protobuf.Empty) returns (stream PushMessageResp);
|
||||
}
|
||||
|
||||
//
|
||||
message PushMessageResp {
|
||||
// 业务类型
|
||||
enum Biz {
|
||||
// 未知
|
||||
BIZ_UNKNOWN = 0;
|
||||
// 视频
|
||||
BIZ_VIDEO = 1;
|
||||
// 直播
|
||||
BIZ_LIVE = 2;
|
||||
// 活动
|
||||
BIZ_ACTIVITY = 3;
|
||||
}
|
||||
// 消息类型
|
||||
enum Type {
|
||||
// 未知
|
||||
TYPE_UNKNOWN = 0;
|
||||
// 默认
|
||||
TYPE_DEFAULT = 1;
|
||||
// 热门
|
||||
TYPE_HOT = 2;
|
||||
// 实时
|
||||
TYPE_REALTIME = 3;
|
||||
// 推荐
|
||||
TYPE_RECOMMEND = 4;
|
||||
}
|
||||
// 展示未知
|
||||
enum Position {
|
||||
// 未知
|
||||
POS_UNKNOWN = 0;
|
||||
// 顶部
|
||||
POS_TOP = 1;
|
||||
}
|
||||
// Deprecated: 推送任务id,使用string
|
||||
int64 old_taskid = 1;
|
||||
// 业务
|
||||
// 1:是视频 2:是直播 3:是活动
|
||||
Biz biz = 2;
|
||||
// 类型
|
||||
// 1:是默认 2:是热门 3:是实时 4:是推荐
|
||||
Type type = 3;
|
||||
// 主标题
|
||||
string title = 4;
|
||||
// 副标题
|
||||
string summary = 5;
|
||||
// 图片地址
|
||||
string img = 6;
|
||||
// 跳转地址
|
||||
string link = 7;
|
||||
// 展示位置,1是顶部
|
||||
Position position = 8;
|
||||
// 展示时长(单位:秒),默认3秒
|
||||
int32 duration = 9;
|
||||
// 失效时间
|
||||
int64 expire = 10;
|
||||
// 推送任务id
|
||||
string taskid = 11;
|
||||
// 应用内推送黑名单
|
||||
// UGC: ugc-video-detail
|
||||
// PGC: pgc-video-detail
|
||||
// 一起看: pgc-video-detail-theater
|
||||
// 直播: live-room-detail
|
||||
// Story: ugc-video-detail-vertical
|
||||
// 播单黑名单 playlist-video-detail
|
||||
repeated PageBlackList page_blackList = 12;
|
||||
// 预留pvid
|
||||
repeated PageView page_view = 13;
|
||||
// 跳转资源
|
||||
TargetResource target_resource = 14;
|
||||
}
|
||||
|
||||
//
|
||||
message PageBlackList {
|
||||
//
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
//
|
||||
message PageView {
|
||||
//
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
//
|
||||
enum LinkType {
|
||||
// 未知
|
||||
LINK_TYPE_UNKNOWN = 0;
|
||||
// 番剧
|
||||
LINK_TYPE_BANGUMI = 1;
|
||||
// 视频
|
||||
LINK_TYPE_VIDEO = 2;
|
||||
// 直播
|
||||
LINK_TYPE_LIVE = 3;
|
||||
}
|
||||
|
||||
//
|
||||
message TargetResource {
|
||||
//直播: roomid
|
||||
//UGC: avid
|
||||
//PGC: seasonid
|
||||
//Story: avid
|
||||
//举个例子
|
||||
//Type: LINK_TYPE_BANGUMI (番剧)
|
||||
//Resource: {"seasonid":"123"}
|
||||
//
|
||||
//Type: LINK_TYPE_VIDEO (视频)
|
||||
//Resource: {"avid":"123"}
|
||||
//
|
||||
//Type: LINK_TYPE_LIVE (直播)
|
||||
//Resource: {"roomid":"123"}
|
||||
//
|
||||
LinkType Type = 1;
|
||||
//
|
||||
map<string,string> Resource = 2;
|
||||
}
|
||||
72
grpc_api/bilibili/broadcast/v1/room.proto
Normal file
72
grpc_api/bilibili/broadcast/v1/room.proto
Normal file
@@ -0,0 +1,72 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "bilibili/rpc/status.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
//
|
||||
service BroadcastRoom {
|
||||
//
|
||||
rpc Enter(stream RoomReq) returns (stream RoomResp);
|
||||
}
|
||||
|
||||
//
|
||||
message RoomJoinEvent {}
|
||||
|
||||
//
|
||||
message RoomLeaveEvent {}
|
||||
|
||||
//
|
||||
message RoomOnlineEvent {
|
||||
//
|
||||
int32 online = 1;
|
||||
}
|
||||
|
||||
//
|
||||
message RoomMessageEvent {
|
||||
//
|
||||
string target_path = 1;
|
||||
//
|
||||
google.protobuf.Any body = 2;
|
||||
}
|
||||
|
||||
//
|
||||
message RoomErrorEvent {
|
||||
//
|
||||
bilibili.rpc.Status status = 1;
|
||||
}
|
||||
|
||||
//
|
||||
message RoomReq {
|
||||
// {type}://{room_id}
|
||||
string id = 1;
|
||||
oneof event {
|
||||
//
|
||||
RoomJoinEvent join = 2;
|
||||
//
|
||||
RoomLeaveEvent leave = 3;
|
||||
//
|
||||
RoomOnlineEvent online = 4;
|
||||
//
|
||||
RoomMessageEvent msg = 5;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
message RoomResp {
|
||||
// {type}://{room_id}
|
||||
string id = 1;
|
||||
oneof event {
|
||||
//
|
||||
RoomJoinEvent join = 2;
|
||||
//
|
||||
RoomLeaveEvent leave = 3;
|
||||
//
|
||||
RoomOnlineEvent online = 4;
|
||||
//
|
||||
RoomMessageEvent msg = 5;
|
||||
//
|
||||
RoomErrorEvent err = 6;
|
||||
}
|
||||
}
|
||||
26
grpc_api/bilibili/broadcast/v1/test.proto
Normal file
26
grpc_api/bilibili/broadcast/v1/test.proto
Normal file
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bilibili.broadcast.v1;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// 服务端下发的测试专用消息,客户端debug/release包都会通过弹窗响应该消息
|
||||
// 后端平台 必须 限制该消息只能针对单个用户发送
|
||||
|
||||
// Test
|
||||
service Test {
|
||||
// 监听上报事件
|
||||
rpc WatchTestEvent(google.protobuf.Empty) returns (stream TestResp);
|
||||
}
|
||||
|
||||
message TestResp {
|
||||
// 任务id
|
||||
int64 taskid = 1 [json_name="taskid"];
|
||||
// 时间戳
|
||||
int64 timestamp = 2 [json_name="timestamp"];
|
||||
// 消息
|
||||
string message = 3 [json_name="message"];
|
||||
// 扩展
|
||||
google.protobuf.Any extra = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user