close를 writecontrol로 변경

This commit is contained in:
2023-07-18 17:20:47 +09:00
parent 40a603522d
commit 8df248fa54

View File

@ -11,6 +11,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"sync" "sync"
"time"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"repositories.action2quare.com/ayo/gocommon" "repositories.action2quare.com/ayo/gocommon"
@ -430,7 +431,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
if conn != nil { if conn != nil {
if room := findRoom(roomName, false); room != nil { if room := findRoom(roomName, false); room != nil {
if conn.popRoom(room.out(conn)) == 0 { if conn.popRoom(room.out(conn)) == 0 {
conn.Close() conn.WriteControl(websocket.CloseMessage, []byte("normal"), time.Time{})
} }
break break
} }
@ -490,7 +491,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
if conn != nil { if conn != nil {
if room := findRoom(roomName, false); room != nil { if room := findRoom(roomName, false); room != nil {
if conn.popRoom(room.out(conn)) == 0 { if conn.popRoom(room.out(conn)) == 0 {
conn.Close() conn.WriteControl(websocket.CloseMessage, []byte("normal"), time.Time{})
} }
} }
} }