2023-07-24 08:07:05 +00:00
|
|
|
syntax = "v1"
|
|
|
|
|
|
|
|
info (
|
|
|
|
title: "websocket"// TODO: add title
|
|
|
|
desc: // TODO: add description
|
|
|
|
author: ""
|
|
|
|
email: ""
|
|
|
|
)
|
|
|
|
|
|
|
|
import "basic.api"
|
|
|
|
service websocket {
|
|
|
|
//websocket数据交互
|
|
|
|
@handler DataTransferHandler
|
2023-10-11 10:54:14 +00:00
|
|
|
get /api/websocket/data_transfer(DataTransferReq) returns (response);
|
2023-08-16 04:16:23 +00:00
|
|
|
//云渲染完了通知接口
|
|
|
|
@handler RenderNotifyHandler
|
|
|
|
post /api/websocket/render_notify(RenderNotifyReq) returns (response);
|
2023-08-24 07:45:23 +00:00
|
|
|
//通用回调接口
|
|
|
|
@handler CommonNotifyHandler
|
|
|
|
post /api/websocket/common_notify(CommonNotifyReq) returns (response);
|
2023-10-20 07:14:41 +00:00
|
|
|
//获取ws统计信息
|
|
|
|
@handler GetStatHandler
|
2023-10-20 07:15:03 +00:00
|
|
|
get /api/websocket/get_stat(GetStatReq) returns (response);
|
2023-08-16 04:16:23 +00:00
|
|
|
}
|
|
|
|
|
2023-10-11 10:54:14 +00:00
|
|
|
//websocket数据交互[
|
|
|
|
type DataTransferReq {
|
2023-10-11 11:12:45 +00:00
|
|
|
Wid string `form:"wid,optional"`
|
2023-10-11 10:54:14 +00:00
|
|
|
}
|
2023-08-16 04:16:23 +00:00
|
|
|
//渲染完了通知接口
|
|
|
|
type RenderNotifyReq {
|
2023-11-13 02:35:51 +00:00
|
|
|
TaskId string `json:"task_id"`
|
|
|
|
Image string `json:"image"`
|
|
|
|
Code int `json:"code,optional"`
|
|
|
|
Msg string `json:"msg,optional"`
|
|
|
|
CostTime string `json:"cost_time"` //unity处理时间
|
2023-08-23 07:08:45 +00:00
|
|
|
}
|
2023-08-24 07:45:23 +00:00
|
|
|
//通用回调接口
|
|
|
|
type CommonNotifyReq {
|
2023-09-04 09:11:40 +00:00
|
|
|
Wid string `json:"wid,optional"` //websocket连接标识(找ws连接优先级高于user_id和guestid)
|
2023-09-04 07:00:11 +00:00
|
|
|
UserId int64 `json:"user_id,optional"` //用户id
|
|
|
|
GuestId int64 `json:"guest_id,optional"` //游客id
|
|
|
|
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
|
2023-10-17 07:40:44 +00:00
|
|
|
}
|
2023-10-20 07:14:41 +00:00
|
|
|
//获取ws统计信息
|
|
|
|
type GetStatReq {
|
2023-11-01 06:48:50 +00:00
|
|
|
Password string `form:"password"`
|
|
|
|
UserKeys string `form:"user_keys,optional"`
|
2023-10-20 07:14:41 +00:00
|
|
|
}
|
|
|
|
type GetStatRsp {
|
2023-11-01 03:22:29 +00:00
|
|
|
WsTotalCount int `json:"ws_total_count"` //ws连接总数
|
|
|
|
CurCombineCount int `json:"cur_combine_count"` //合图任务数
|
2023-11-01 06:35:37 +00:00
|
|
|
CombineErrorCount int `json:"combine_error_count"` //合图失败数
|
2023-11-01 03:22:29 +00:00
|
|
|
CurUnityHandleCount int `json:"cur_unity_handle_count"` //当前unity请求总数
|
2023-11-01 07:43:25 +00:00
|
|
|
UnityErrorCount int `json:"unity_error_count"` //unity错误统计
|
2023-11-01 03:22:29 +00:00
|
|
|
UserWsStat interface{} `json:"user_ws_stat"` //用户连接统计
|
2023-07-24 08:07:05 +00:00
|
|
|
}
|