mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-06 01:03:43 +08:00
fixed bug for websocket close tip message
This commit is contained in:
@@ -42,14 +42,8 @@ func (h *MarkMapHandler) Client(c *gin.Context) {
|
||||
|
||||
modelId := h.GetInt(c, "model_id", 0)
|
||||
userId := h.GetInt(c, "user_id", 0)
|
||||
logger.Info(modelId)
|
||||
|
||||
client := types.NewWsClient(ws)
|
||||
if cli := h.clients.Get(userId); cli != nil {
|
||||
cli.Close()
|
||||
}
|
||||
|
||||
// 保存会话连接
|
||||
h.clients.Put(userId, client)
|
||||
go func() {
|
||||
for {
|
||||
|
||||
@@ -78,10 +78,6 @@ func (h *MidJourneyHandler) Client(c *gin.Context) {
|
||||
}
|
||||
|
||||
client := types.NewWsClient(ws)
|
||||
// close the existed connections
|
||||
if cli := h.pool.Clients.Get(uint(userId)); cli != nil {
|
||||
cli.Close()
|
||||
}
|
||||
h.pool.Clients.Put(uint(userId), client)
|
||||
logger.Infof("New websocket connected, IP: %s", c.RemoteIP())
|
||||
}
|
||||
|
||||
@@ -61,10 +61,6 @@ func (h *SdJobHandler) Client(c *gin.Context) {
|
||||
}
|
||||
|
||||
client := types.NewWsClient(ws)
|
||||
// close the existed connections
|
||||
if cli := h.pool.Clients.Get(uint(userId)); cli != nil {
|
||||
cli.Close()
|
||||
}
|
||||
h.pool.Clients.Put(uint(userId), client)
|
||||
logger.Infof("New websocket connected, IP: %s", c.RemoteIP())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user