master
chendian 1 year ago
parent df2a35ee06
commit 7eb91b27bd

@ -144,6 +144,7 @@ func OnDataPush(c *gin.Context) {
} }
for _, notify := range notifyData { for _, notify := range notifyData {
redis.Publish(appId, roomId, notify) redis.Publish(appId, roomId, notify)
fmt.Println("[Publish]", appId, roomId)
} }
} }

@ -92,6 +92,7 @@ func Subscribe(appId string, roomId string, pushFunc func(string), pushCloseChan
go func() { go func() {
for { for {
msg, err := ps.ReceiveMessage(context.Background()) msg, err := ps.ReceiveMessage(context.Background())
fmt.Println("ReceiveMessage", msg, err)
if err != nil { if err != nil {
return return
} }

@ -191,6 +191,8 @@ func (s *User) OnGetRank(msg *pb.GetRank) {
func (s *User) setPushActive(isActive bool) { func (s *User) setPushActive(isActive bool) {
if isActive { if isActive {
s.Log("SetPushActive1", s.appId)
s.Log("SetPushActive2", s.roomId)
redis.Subscribe(s.appId, s.roomId, s.OnRecvPush, s.pushCloseChan) redis.Subscribe(s.appId, s.roomId, s.OnRecvPush, s.pushCloseChan)
if !s.isDebug { if !s.isDebug {
s.mgr.StartTask(s.appId, s.roomId, "1") s.mgr.StartTask(s.appId, s.roomId, "1")

Loading…
Cancel
Save