fix
This commit is contained in:
parent
2cb4549f00
commit
2a06a28ad6
|
@ -76,9 +76,11 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
|||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
w.Header().Set("Connection", "Upgrade")
|
||||
rsp := types.DataTransferData{}
|
||||
//鉴权不成功10秒后断开
|
||||
/*if !l.checkAuth(svcCtx, r) {
|
||||
if !l.checkAuth(svcCtx, r) {
|
||||
time.Sleep(time.Second) //兼容下火狐
|
||||
rsp.T = constants.WEBSOCKET_UNAUTH
|
||||
b, _ := json.Marshal(rsp)
|
||||
//先发一条正常信息
|
||||
|
@ -86,7 +88,7 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
|||
//发送关闭信息
|
||||
_ = conn.WriteMessage(websocket.CloseMessage, nil)
|
||||
return
|
||||
}*/
|
||||
}
|
||||
//生成连接唯一标识
|
||||
flag := uuid.New().String() + "<date=" + time.Now().Format("2006-01-02-15-04-05") + ">"
|
||||
ws := wsConnectItem{
|
||||
|
@ -104,6 +106,7 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
|||
mapConnPool.Store(flag, ws)
|
||||
defer ws.close()
|
||||
//把连接成功消息发回去
|
||||
time.Sleep(time.Second) //兼容下火狐
|
||||
rsp.T = constants.WEBSOCKET_CONNECT_SUCCESS
|
||||
rsp.D = flag
|
||||
b, _ := json.Marshal(rsp)
|
||||
|
|
Loading…
Reference in New Issue
Block a user