fix
This commit is contained in:
parent
db5b576799
commit
d91a7c0058
|
@ -94,7 +94,7 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
||||||
)
|
)
|
||||||
isAuth, userInfo = l.checkAuth(svcCtx, r)
|
isAuth, userInfo = l.checkAuth(svcCtx, r)
|
||||||
if !isAuth {
|
if !isAuth {
|
||||||
time.Sleep(time.Second) //兼容下火狐
|
time.Sleep(time.Second * 4) //兼容下火狐
|
||||||
rsp := websocket_data.DataTransferData{
|
rsp := websocket_data.DataTransferData{
|
||||||
T: constants.WEBSOCKET_UNAUTH,
|
T: constants.WEBSOCKET_UNAUTH,
|
||||||
D: nil,
|
D: nil,
|
||||||
|
@ -130,10 +130,12 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
||||||
//保存连接
|
//保存连接
|
||||||
mapConnPool.Store(uniqueId, ws)
|
mapConnPool.Store(uniqueId, ws)
|
||||||
defer ws.close()
|
defer ws.close()
|
||||||
//把连接成功消息发回去
|
go func() {
|
||||||
time.Sleep(time.Second) //兼容下火狐
|
//把连接成功消息发回去
|
||||||
b := ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId)
|
time.Sleep(time.Second * 4) //兼容下火狐
|
||||||
_ = conn.WriteMessage(websocket.TextMessage, b)
|
b := ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId)
|
||||||
|
_ = conn.WriteMessage(websocket.TextMessage, b)
|
||||||
|
}()
|
||||||
//循环读客户端信息
|
//循环读客户端信息
|
||||||
go ws.readLoop()
|
go ws.readLoop()
|
||||||
//循环把数据发送给客户端
|
//循环把数据发送给客户端
|
||||||
|
|
Loading…
Reference in New Issue
Block a user