fix
This commit is contained in:
parent
bef22ffbcc
commit
ecd06fc837
|
@ -185,7 +185,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||
if isFirefoxBrowser {
|
||||
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||
}
|
||||
l.sendGetUniqueIdErrResponse(conn)
|
||||
l.sendGetUniqueIdErrResponse(conn, userInfo.Debug)
|
||||
return wsConnectItem{}, err
|
||||
}
|
||||
//传入绑定的wid判断是否可重用
|
||||
|
@ -442,8 +442,9 @@ func (w *wsConnectItem) sendToInChan(data []byte) {
|
|||
// 格式化为websocket标准返回格式
|
||||
func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data interface{}) []byte {
|
||||
d := websocket_data.DataTransferData{
|
||||
T: msgType,
|
||||
D: data,
|
||||
T: msgType,
|
||||
D: data,
|
||||
Debug: w.debug != nil,
|
||||
}
|
||||
b, _ := json.Marshal(d)
|
||||
return b
|
||||
|
|
|
@ -3,16 +3,18 @@ package logic
|
|||
import (
|
||||
"encoding/json"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/websocket_data"
|
||||
"github.com/gorilla/websocket"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 获取唯一标识失败通知
|
||||
func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn) {
|
||||
func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn, debug *auth.Debug) {
|
||||
rsp := websocket_data.DataTransferData{
|
||||
T: constants.WEBSOCKET_CONNECT_ERR,
|
||||
D: websocket_data.ConnectErrMsg{Message: "err to gen unique id "},
|
||||
T: constants.WEBSOCKET_CONNECT_ERR,
|
||||
D: websocket_data.ConnectErrMsg{Message: "err to gen unique id "},
|
||||
Debug: debug != nil,
|
||||
}
|
||||
b, _ := json.Marshal(rsp)
|
||||
//先发一条正常信息
|
||||
|
@ -24,8 +26,9 @@ func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn) {
|
|||
// 鉴权失败通知
|
||||
func (l *DataTransferLogic) unAuthResponse(conn *websocket.Conn, isFirefoxBrowser bool, errMessage string) {
|
||||
rsp := websocket_data.DataTransferData{
|
||||
T: constants.WEBSOCKET_UNAUTH,
|
||||
D: websocket_data.ConnectUnAuth{Message: errMessage},
|
||||
T: constants.WEBSOCKET_UNAUTH,
|
||||
D: websocket_data.ConnectUnAuth{Message: errMessage},
|
||||
Debug: false,
|
||||
}
|
||||
b, _ := json.Marshal(rsp)
|
||||
if isFirefoxBrowser {
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package websocket_data
|
||||
|
||||
import "fusenapi/constants"
|
||||
|
||||
// websocket数据交互基本数据类型
|
||||
type DataTransferData struct {
|
||||
T constants.Websocket `json:"t"` //消息类型
|
||||
D interface{} `json:"d"` //传递的消息
|
||||
Debug bool `json:"debug"` //是否开启debug
|
||||
}
|
||||
|
||||
// 基础连接成功返回
|
||||
type ConnectSuccessMsg struct {
|
||||
Wid string `json:"wid"` //websocket连接唯一标识
|
||||
Debug bool `json:"debug"` //是否开启debug
|
||||
Wid string `json:"wid"` //websocket连接唯一标识
|
||||
}
|
||||
|
||||
// 连接失败
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package websocket_data
|
||||
|
||||
import "fusenapi/constants"
|
||||
|
||||
// websocket数据交互基本数据类型
|
||||
type DataTransferData struct {
|
||||
T constants.Websocket `json:"t"` //消息类型
|
||||
D interface{} `json:"d"` //传递的消息
|
||||
}
|
||||
|
||||
// websocket接受要云渲染处理的数据
|
||||
type RenderImageReqMsg struct {
|
||||
RenderId string `json:"render_id"` //渲染id
|
||||
|
|
Loading…
Reference in New Issue
Block a user