fusenapi/server_api/websocket.api

49 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-07-24 16:07:05 +08: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 18:54:14 +08:00
get /api/websocket/data_transfer(DataTransferReq) returns (response);
2023-08-16 12:16:23 +08:00
//云渲染完了通知接口
@handler RenderNotifyHandler
post /api/websocket/render_notify(RenderNotifyReq) returns (response);
2023-08-24 15:45:23 +08:00
//通用回调接口
@handler CommonNotifyHandler
post /api/websocket/common_notify(CommonNotifyReq) returns (response);
2023-10-17 15:40:44 +08:00
//关闭某个连接
@handler CloseWebsocketHandler
post /api/websocket/close_websocket(CloseWebsocketReq) returns (response);
2023-08-16 12:16:23 +08:00
}
2023-10-11 18:54:14 +08:00
//websocket数据交互[
type DataTransferReq {
2023-10-11 19:12:45 +08:00
Wid string `form:"wid,optional"`
2023-10-11 18:54:14 +08:00
}
2023-08-16 12:16:23 +08:00
//渲染完了通知接口
type RenderNotifyReq {
2023-10-08 15:29:03 +08:00
TaskId string `json:"task_id"`
2023-08-16 12:16:23 +08:00
UserId int64 `json:"user_id"`
GuestId int64 `json:"guest_id"`
Image string `json:"image"`
2023-10-08 17:04:37 +08:00
Code int `json:"code,optional"`
Msg string `json:"msg,optional"`
2023-08-23 15:08:45 +08:00
}
2023-08-24 15:45:23 +08:00
//通用回调接口
type CommonNotifyReq {
2023-09-04 17:11:40 +08:00
Wid string `json:"wid,optional"` //websocket连接标识(找ws连接优先级高于user_id和guestid)
2023-09-04 15:00:11 +08:00
UserId int64 `json:"user_id,optional"` //用户id
GuestId int64 `json:"guest_id,optional"` //游客id
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
2023-10-17 15:40:44 +08:00
}
//关闭连接
type CloseWebsocketReq {
Wid string `json:"wid"`
2023-07-24 16:07:05 +08:00
}