fix
This commit is contained in:
parent
fdaddf9184
commit
265fd81b27
|
@ -106,7 +106,7 @@ func (l *DataTransferLogic) DataTransfer(svcCtx *svc.ServiceContext, w http.Resp
|
|||
rsp.T = constants.WEBSOCKET_CONNECT_SUCCESS
|
||||
rsp.D = flag
|
||||
b, _ := json.Marshal(rsp)
|
||||
conn.WriteMessage(websocket.TextMessage, b)
|
||||
_ = conn.WriteMessage(websocket.TextMessage, b)
|
||||
//循环读客户端信息
|
||||
go ws.readLoop()
|
||||
//循环把数据发送给客户端
|
||||
|
@ -181,7 +181,11 @@ func (w *wsConnectItem) writeLoop() {
|
|||
case <-w.closeChan: //如果关闭了
|
||||
return
|
||||
case data := <-w.outChan:
|
||||
w.conn.WriteMessage(websocket.TextMessage, data)
|
||||
if err := w.conn.WriteMessage(websocket.TextMessage, data); err != nil {
|
||||
logx.Error("websocket write loop err:", err)
|
||||
w.close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user