fix
This commit is contained in:
parent
c3674bb7da
commit
7d50379b3d
|
@ -79,6 +79,8 @@ var (
|
|||
renderImageTaskCtlChanLen = 500
|
||||
//渲染任务缓冲队列长度
|
||||
renderChanLen = 500
|
||||
//是否开启debug
|
||||
openDebug = false
|
||||
)
|
||||
|
||||
// 用户标识的连接增删操作队列传输的值的结构
|
||||
|
@ -322,6 +324,14 @@ func getmapUserConnPoolUniqueId(userId, guestId int64) (uniqueId string) {
|
|||
return fmt.Sprintf("%d_%d", userId, guestId)
|
||||
}
|
||||
|
||||
// 获取websocket发送到前端使用的数据传输类型(debug开启是文本,否则是二进制)
|
||||
func getWebsocketBaseTransferDataFormat() int {
|
||||
if openDebug {
|
||||
return websocket.TextMessage
|
||||
}
|
||||
return websocket.BinaryMessage
|
||||
}
|
||||
|
||||
// 获取唯一id
|
||||
func (l *DataTransferLogic) getUniqueId(userInfo *auth.UserInfo, userAgent string, retryTimes int) (uniqueId string, err error) {
|
||||
if retryTimes < 0 {
|
||||
|
@ -369,7 +379,7 @@ func (l *DataTransferLogic) unAuthResponse(conn *websocket.Conn, isFirefoxBrowse
|
|||
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
|
||||
}
|
||||
//先发一条正常信息
|
||||
_ = conn.WriteMessage(websocket.TextMessage, b)
|
||||
_ = conn.WriteMessage(getWebsocketBaseTransferDataFormat(), b)
|
||||
//发送关闭信息
|
||||
_ = conn.WriteMessage(websocket.CloseMessage, nil)
|
||||
}
|
||||
|
@ -383,7 +393,7 @@ func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn) {
|
|||
}
|
||||
b, _ := json.Marshal(rsp)
|
||||
//先发一条正常信息
|
||||
_ = conn.WriteMessage(websocket.TextMessage, b)
|
||||
_ = conn.WriteMessage(getWebsocketBaseTransferDataFormat(), b)
|
||||
//发送关闭信息
|
||||
_ = conn.WriteMessage(websocket.CloseMessage, nil)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user