This commit is contained in:
laodaming 2023-09-07 16:03:56 +08:00
parent 35eb087b5a
commit 998975e413
2 changed files with 7 additions and 3 deletions

View File

@ -200,9 +200,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
//保存连接
mapConnPool.Store(uniqueId, ws)
//非白板用户需要为这个用户建立map索引便于通过用户查询
if userInfo.IsUser() || userInfo.IsGuest() {
createUserConnPoolElement(userInfo.UserId, userInfo.GuestId, uniqueId)
}
createUserConnPoolElement(userInfo.UserId, userInfo.GuestId, uniqueId)
if isFirefoxBrowser {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
}

View File

@ -16,6 +16,9 @@ var (
// 添加用户索引池ws连接
func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
if userId == 0 && guestId == 0 {
return
}
data := userConnPoolCtlChanItem{
userId: userId,
guestId: guestId,
@ -34,6 +37,9 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
// 从用户索引池删除ws连接
func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
if userId == 0 && guestId == 0 {
return
}
data := userConnPoolCtlChanItem{
userId: userId,
guestId: guestId,