fix
This commit is contained in:
parent
2d498a06a0
commit
1309473d7b
|
@ -99,7 +99,7 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request)
|
||||||
)
|
)
|
||||||
isAuth, userInfo = l.checkAuth(r)
|
isAuth, userInfo = l.checkAuth(r)
|
||||||
if !isAuth {
|
if !isAuth {
|
||||||
time.Sleep(time.Second * 1) //兼容下火狐
|
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||||
rsp := websocket_data.DataTransferData{
|
rsp := websocket_data.DataTransferData{
|
||||||
T: constants.WEBSOCKET_UNAUTH,
|
T: constants.WEBSOCKET_UNAUTH,
|
||||||
D: nil,
|
D: nil,
|
||||||
|
@ -111,9 +111,6 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request)
|
||||||
_ = conn.WriteMessage(websocket.CloseMessage, nil)
|
_ = conn.WriteMessage(websocket.CloseMessage, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// todo user信息是没有的
|
|
||||||
/*var userInfo auth.UserInfo
|
|
||||||
userInfo.UserId = 39*/
|
|
||||||
//设置连接
|
//设置连接
|
||||||
ws := l.setConnPool(conn, *userInfo)
|
ws := l.setConnPool(conn, *userInfo)
|
||||||
defer ws.close()
|
defer ws.close()
|
||||||
|
@ -156,7 +153,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo auth.User
|
||||||
mapConnPool.Store(uniqueId, ws)
|
mapConnPool.Store(uniqueId, ws)
|
||||||
go func() {
|
go func() {
|
||||||
//把连接成功消息发回去
|
//把连接成功消息发回去
|
||||||
time.Sleep(time.Second * 1) //兼容下火狐
|
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||||
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId))
|
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId))
|
||||||
}()
|
}()
|
||||||
return ws
|
return ws
|
||||||
|
|
Loading…
Reference in New Issue
Block a user