Ver Fonte

修改bug

yjp há 5 meses atrás
pai
commit
4853336c41
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      websocket/websocket.go

+ 2 - 2
websocket/websocket.go

@@ -211,7 +211,7 @@ func (m *Manager) HandleRequest(groupID string, w http.ResponseWriter, r *http.R
 		return errors.New("groupID尚未注册")
 	}
 
-	sessionMap := map[string]any{}
+	sessionMap := make(map[string]any)
 
 	for _, opt := range opts {
 		opt(&sessionMap)
@@ -320,6 +320,6 @@ type ConnectionOption func(sessionMap *map[string]any)
 
 func WithConnectionContext(context map[string]any) ConnectionOption {
 	return func(sessionMap *map[string]any) {
-		sessionMap = &context
+		*sessionMap = context
 	}
 }