优化ws代码结构
This commit is contained in:
parent
a3c1b12078
commit
34c8014c95
|
@ -505,9 +505,13 @@ func (w *wsConnectItem) reciveBrowserMessage() {
|
||||||
w.close()
|
w.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//ping/pong/close的消息不处理
|
switch msgType {
|
||||||
if msgType != websocket.PingMessage && msgType != websocket.PongMessage && msgType != websocket.CloseMessage {
|
case websocket.PingMessage, websocket.PongMessage: //心跳消息(过滤不处理)
|
||||||
|
continue
|
||||||
|
case websocket.BinaryMessage, websocket.TextMessage: //主要消息
|
||||||
w.sendToInChan(data)
|
w.sendToInChan(data)
|
||||||
|
case websocket.CloseMessage: //客户端主动关闭消息
|
||||||
|
w.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user