opt: close unused websocket connections

This commit is contained in:
RockYang
2024-04-30 22:54:39 +08:00
parent 7bb76d581c
commit cc1a3ce343
17 changed files with 144 additions and 85 deletions

View File

@@ -137,6 +137,7 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
for {
_, msg, err := client.Receive()
if err != nil {
logger.Debugf("close connection: %s", client.Conn.RemoteAddr())
client.Close()
h.App.ChatClients.Delete(sessionId)
h.App.ChatSession.Delete(sessionId)