fix
This commit is contained in:
parent
b085f3dbef
commit
df8772812a
|
@ -114,12 +114,6 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
||||||
userInfo.UserId = 39
|
userInfo.UserId = 39
|
||||||
ws := l.setConnPool(conn, userInfo)
|
ws := l.setConnPool(conn, userInfo)
|
||||||
defer ws.close()
|
defer ws.close()
|
||||||
go func() {
|
|
||||||
//把连接成功消息发回去
|
|
||||||
time.Sleep(time.Second * 2) //兼容下火狐
|
|
||||||
b := ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId)
|
|
||||||
_ = conn.WriteMessage(websocket.TextMessage, b)
|
|
||||||
}()
|
|
||||||
//循环读客户端信息
|
//循环读客户端信息
|
||||||
go ws.readLoop()
|
go ws.readLoop()
|
||||||
//循环把数据发送给客户端
|
//循环把数据发送给客户端
|
||||||
|
@ -156,6 +150,12 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo auth.User
|
||||||
}
|
}
|
||||||
//保存连接
|
//保存连接
|
||||||
mapConnPool.Store(uniqueId, ws)
|
mapConnPool.Store(uniqueId, ws)
|
||||||
|
go func() {
|
||||||
|
//把连接成功消息发回去
|
||||||
|
time.Sleep(time.Second * 2) //兼容下火狐
|
||||||
|
b := ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId)
|
||||||
|
_ = conn.WriteMessage(websocket.TextMessage, b)
|
||||||
|
}()
|
||||||
return ws
|
return ws
|
||||||
}
|
}
|
||||||
func (l *DataTransferLogic) getUniqueId() string {
|
func (l *DataTransferLogic) getUniqueId() string {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user