wangshan 3 kuukautta sitten
vanhempi
commit
40f76f1f8c
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      services/sse/sse.go

+ 2 - 2
services/sse/sse.go

@@ -31,7 +31,8 @@ func (s *ServerSentRouter) Notify() {
 	sessVal := s.Session().GetMultiple()
 	userId := common.ObjToString(sessVal["userId"])
 	log.Println("message  userId:", userId)
-	//userId = s.GetString("userId")
+	userId = s.GetString("userId")
+	log.Println("params  userId:", s.GetString("userId"))
 	if userId != "" {
 		// 创建用户专属的消息通道
 		messageChan := make(chan string)
@@ -39,7 +40,6 @@ func (s *ServerSentRouter) Notify() {
 		util.SseClientsMu.Lock()
 		util.SseClients[userId] = messageChan
 		util.SseClientsMu.Unlock()
-
 		// 客户端断开时清理资源
 		defer func() {
 			util.SseClientsMu.Lock()