diff --git a/subscribe/redis.go b/subscribe/redis.go index 814f630..093aa60 100644 --- a/subscribe/redis.go +++ b/subscribe/redis.go @@ -9,7 +9,7 @@ import ( func Subscribe(ctx context.Context, redisConn redis.Conn) { s := ofs_redis.New(ctx, redisConn) - webS := newWebSubscriberHandler(ctx, "web") + webS := newWebSubscriberHandler(ctx, "/web") s.Subscribe(webS) } diff --git a/subscribe/web_subscriber_handlers.go b/subscribe/web_subscriber_handlers.go index 6f873e1..f9de697 100644 --- a/subscribe/web_subscriber_handlers.go +++ b/subscribe/web_subscriber_handlers.go @@ -21,10 +21,10 @@ type webSubscriberHandlers struct { ctx context.Context } -func (h *webSubscriberHandlers) OnSubscribe(payload string) { - uid := "kdkdkd" - channel := "web" - soc := server.GetSocket(channel, uid) - - soc.Write([]byte(payload)) +func (h *webSubscriberHandlers) OnSubscribe(channel string, message ofs.SubscribeMessage) { + for _, uid := range message.Targets { + if soc := server.GetSocket(channel, uid); nil != soc { + soc.Write(message.Message) + } + } }