This commit is contained in:
laodaming
2023-10-18 14:40:50 +08:00
parent 57e6b0227f
commit fbbf6b984f
3 changed files with 7 additions and 8 deletions

View File

@@ -238,7 +238,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
if isFirefoxBrowser {
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()
return ws, nil
@@ -452,9 +452,8 @@ 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,
Debug: w.debug != nil,
T: msgType,
D: data,
}
b, _ := json.Marshal(d)
return b