fusenapi/server_api/websocket.api
laodaming d197771eb3 fix
2023-10-20 15:15:03 +08:00

60 lines
1.8 KiB
Plaintext

syntax = "v1"
info (
title: "websocket"// TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service websocket {
//websocket数据交互
@handler DataTransferHandler
get /api/websocket/data_transfer(DataTransferReq) returns (response);
//云渲染完了通知接口
@handler RenderNotifyHandler
post /api/websocket/render_notify(RenderNotifyReq) returns (response);
//通用回调接口
@handler CommonNotifyHandler
post /api/websocket/common_notify(CommonNotifyReq) returns (response);
//关闭某个连接
@handler CloseWebsocketHandler
post /api/websocket/close_websocket(CloseWebsocketReq) returns (response);
//获取ws统计信息
@handler GetStatHandler
get /api/websocket/get_stat(GetStatReq) returns (response);
}
//websocket数据交互[
type DataTransferReq {
Wid string `form:"wid,optional"`
}
//渲染完了通知接口
type RenderNotifyReq {
TaskId string `json:"task_id"`
UserId int64 `json:"user_id"`
GuestId int64 `json:"guest_id"`
Image string `json:"image"`
Code int `json:"code,optional"`
Msg string `json:"msg,optional"`
}
//通用回调接口
type CommonNotifyReq {
Wid string `json:"wid,optional"` //websocket连接标识(找ws连接优先级高于user_id和guestid)
UserId int64 `json:"user_id,optional"` //用户id
GuestId int64 `json:"guest_id,optional"` //游客id
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
}
//关闭连接
type CloseWebsocketReq {
Wid string `json:"wid"`
}
//获取ws统计信息
type GetStatReq {
Password string `form:"password"`
}
type GetStatRsp {
WsTotalCount int `json:"ws_total_count"` //ws连接数
CurRequestCombineCount int `json:"cur_request_combine_count"`
}