diff --git a/api/handler/markmap_handler.go b/api/handler/markmap_handler.go index 794eb284..bfc905f7 100644 --- a/api/handler/markmap_handler.go +++ b/api/handler/markmap_handler.go @@ -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 { diff --git a/api/handler/mj_handler.go b/api/handler/mj_handler.go index 48511ecd..e0e0f020 100644 --- a/api/handler/mj_handler.go +++ b/api/handler/mj_handler.go @@ -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()) } diff --git a/api/handler/sd_handler.go b/api/handler/sd_handler.go index 280799da..b9c3625e 100644 --- a/api/handler/sd_handler.go +++ b/api/handler/sd_handler.go @@ -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()) } diff --git a/web/src/views/ImageMj.vue b/web/src/views/ImageMj.vue index 12952bf7..4f3f0534 100644 --- a/web/src/views/ImageMj.vue +++ b/web/src/views/ImageMj.vue @@ -734,23 +734,7 @@ const connect = () => { _socket.addEventListener('close', () => { if (socket.value !== null) { - ElMessageBox.confirm( - '检测到您已经在其他客户端创建了新的连接,当前连接将被关闭!', - '提示', - { - dangerouslyUseHTMLString: true, - confirmButtonText: '重新连接', - cancelButtonText: '关闭', - type: 'warning', - } - ).then(() => { - connect() - }).catch(() => { - ElMessage({ - type: 'info', - message: '连接已关闭', - }) - }) + connect() } }); } diff --git a/web/src/views/ImageSd.vue b/web/src/views/ImageSd.vue index 2bbc3fa0..c81a9cc9 100644 --- a/web/src/views/ImageSd.vue +++ b/web/src/views/ImageSd.vue @@ -577,23 +577,7 @@ const connect = () => { _socket.addEventListener('close', () => { if (socket.value !== null) { - ElMessageBox.confirm( - '检测到您已经在其他客户端创建了新的连接,当前连接将被关闭!', - '提示', - { - dangerouslyUseHTMLString: true, - confirmButtonText: '重新连接', - cancelButtonText: '关闭', - type: 'warning', - } - ).then(() => { - connect() - }).catch(() => { - ElMessage({ - type: 'info', - message: '连接已关闭', - }) - }) + connect() } }) } diff --git a/web/src/views/MarkMap.vue b/web/src/views/MarkMap.vue index 53e5f8f8..14ad64e1 100644 --- a/web/src/views/MarkMap.vue +++ b/web/src/views/MarkMap.vue @@ -254,23 +254,7 @@ const connect = (userId) => { _socket.addEventListener('close', () => { loading.value = false if (socket.value !== null) { - ElMessageBox.confirm( - '检测到您已经在其他客户端创建了新的连接,当前连接将被关闭!', - '提示', - { - dangerouslyUseHTMLString: true, - confirmButtonText: '重新连接', - cancelButtonText: '关闭', - type: 'warning', - } - ).then(() => { - connect(userId) - }).catch(() => { - ElMessage({ - type: 'info', - message: '连接已关闭', - }) - }) + connect(userId) } }); }