Browse Source

修改bug

yjp 5 months ago
parent
commit
4853336c41
1 changed files with 2 additions and 2 deletions
  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尚未注册")
 		return errors.New("groupID尚未注册")
 	}
 	}
 
 
-	sessionMap := map[string]any{}
+	sessionMap := make(map[string]any)
 
 
 	for _, opt := range opts {
 	for _, opt := range opts {
 		opt(&sessionMap)
 		opt(&sessionMap)
@@ -320,6 +320,6 @@ type ConnectionOption func(sessionMap *map[string]any)
 
 
 func WithConnectionContext(context map[string]any) ConnectionOption {
 func WithConnectionContext(context map[string]any) ConnectionOption {
 	return func(sessionMap *map[string]any) {
 	return func(sessionMap *map[string]any) {
-		sessionMap = &context
+		*sessionMap = context
 	}
 	}
 }
 }