fix
This commit is contained in:
parent
90277394fa
commit
e77638b0e1
|
@ -252,7 +252,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||
if isFirefoxBrowser {
|
||||
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||
}
|
||||
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, uniqueId))
|
||||
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId}))
|
||||
//发送累加统计连接书
|
||||
increaseWebsocketConnectCount()
|
||||
return ws, nil
|
||||
|
@ -306,7 +306,7 @@ func (l *DataTransferLogic) checkAuth(r *http.Request) (isAuth bool, userInfo *a
|
|||
func (l *DataTransferLogic) unAuthResponse(conn *websocket.Conn, isFirefoxBrowser bool) {
|
||||
rsp := websocket_data.DataTransferData{
|
||||
T: constants.WEBSOCKET_UNAUTH,
|
||||
D: nil,
|
||||
D: websocket_data.ConnectUnAuth{Message: "unAuth"},
|
||||
}
|
||||
b, _ := json.Marshal(rsp)
|
||||
if isFirefoxBrowser {
|
||||
|
@ -323,7 +323,7 @@ func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn) {
|
|||
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||
rsp := websocket_data.DataTransferData{
|
||||
T: constants.WEBSOCKET_CONNECT_ERR,
|
||||
D: "err to gen unique id ",
|
||||
D: websocket_data.ConnectErrMsg{Message: "err to gen unique id "},
|
||||
}
|
||||
b, _ := json.Marshal(rsp)
|
||||
//先发一条正常信息
|
||||
|
|
16
utils/websocket_data/base_data.go
Normal file
16
utils/websocket_data/base_data.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package websocket_data
|
||||
|
||||
// 基础连接成功返回
|
||||
type ConnectSuccessMsg struct {
|
||||
Wid string `json:"wid"`
|
||||
}
|
||||
|
||||
// 连接失败
|
||||
type ConnectErrMsg struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// 未授权
|
||||
type ConnectUnAuth struct {
|
||||
Message string `json:"message"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user