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