fix
This commit is contained in:
parent
57e6b0227f
commit
fbbf6b984f
@ -238,7 +238,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) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||||
}
|
}
|
||||||
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId}))
|
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId, Debug: ws.debug != nil}))
|
||||||
//发送累加统计连接书
|
//发送累加统计连接书
|
||||||
increaseWebsocketConnectCount()
|
increaseWebsocketConnectCount()
|
||||||
return ws, nil
|
return ws, nil
|
||||||
@ -452,9 +452,8 @@ func (w *wsConnectItem) sendToInChan(data []byte) {
|
|||||||
// 格式化为websocket标准返回格式
|
// 格式化为websocket标准返回格式
|
||||||
func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data interface{}) []byte {
|
func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data interface{}) []byte {
|
||||||
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
|
||||||
|
@ -2,7 +2,8 @@ package websocket_data
|
|||||||
|
|
||||||
// 基础连接成功返回
|
// 基础连接成功返回
|
||||||
type ConnectSuccessMsg struct {
|
type ConnectSuccessMsg struct {
|
||||||
Wid string `json:"wid"`
|
Wid string `json:"wid"` //websocket连接唯一标识
|
||||||
|
Debug bool `json:"debug"` //是否开启debug
|
||||||
}
|
}
|
||||||
|
|
||||||
// 连接失败
|
// 连接失败
|
||||||
|
@ -4,9 +4,8 @@ import "fusenapi/constants"
|
|||||||
|
|
||||||
// websocket数据交互基本数据类型
|
// websocket数据交互基本数据类型
|
||||||
type DataTransferData struct {
|
type DataTransferData struct {
|
||||||
T constants.Websocket `json:"t"` //消息类型
|
T constants.Websocket `json:"t"` //消息类型
|
||||||
D interface{} `json:"d"` //传递的消息
|
D interface{} `json:"d"` //传递的消息
|
||||||
Debug bool `json:"debug"` //是否开启debug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// websocket接受要云渲染处理的数据
|
// websocket接受要云渲染处理的数据
|
||||||
|
Loading…
x
Reference in New Issue
Block a user