diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 876a789a..d3725a5b 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -99,7 +99,7 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) ) isAuth, userInfo = l.checkAuth(r) if !isAuth { - time.Sleep(time.Second * 1) //兼容下火狐 + time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究) rsp := websocket_data.DataTransferData{ T: constants.WEBSOCKET_UNAUTH, D: nil, @@ -111,9 +111,6 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) _ = conn.WriteMessage(websocket.CloseMessage, nil) return } - // todo user信息是没有的 - /*var userInfo auth.UserInfo - userInfo.UserId = 39*/ //设置连接 ws := l.setConnPool(conn, *userInfo) defer ws.close() @@ -156,7 +153,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo auth.User mapConnPool.Store(uniqueId, ws) go func() { //把连接成功消息发回去 - time.Sleep(time.Second * 1) //兼容下火狐 + time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究) ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId)) }() return ws