From 8df248fa54908a8cb547813179e4269e25c7df87 Mon Sep 17 00:00:00 2001 From: mountain Date: Tue, 18 Jul 2023 17:20:47 +0900 Subject: [PATCH] =?UTF-8?q?close=EB=A5=BC=20writecontrol=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wshandler/wshandler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wshandler/wshandler.go b/wshandler/wshandler.go index 4ffc7db..646cf0d 100644 --- a/wshandler/wshandler.go +++ b/wshandler/wshandler.go @@ -11,6 +11,7 @@ import ( "net/http" "strings" "sync" + "time" "go.mongodb.org/mongo-driver/bson/primitive" "repositories.action2quare.com/ayo/gocommon" @@ -430,7 +431,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) { if conn != nil { if room := findRoom(roomName, false); room != nil { if conn.popRoom(room.out(conn)) == 0 { - conn.Close() + conn.WriteControl(websocket.CloseMessage, []byte("normal"), time.Time{}) } break } @@ -490,7 +491,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) { if conn != nil { if room := findRoom(roomName, false); room != nil { if conn.popRoom(room.out(conn)) == 0 { - conn.Close() + conn.WriteControl(websocket.CloseMessage, []byte("normal"), time.Time{}) } } }