[优化] 增加断开 WebSocket 客户端的功能,优化连接管理

This commit is contained in:
ryan
2026-05-30 18:08:06 +08:00
parent cef3694d11
commit f4a53d6b5f
4 changed files with 23 additions and 1 deletions
+6
View File
@@ -150,6 +150,12 @@ func AgentWebSocket(c *gin.Context) {
}()
slog.Debug("agent ws upgrade succeeded", "node_id", node.NodeID, "remote", c.Request.RemoteAddr)
go func() {
<-client.Done()
_ = conn.Close()
}()
go streamAgentWSMessages(c, conn, client)
for {