From 83c0e4d252c18cd19b9404d5a6b6a18fba33d289 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 27 Sep 2017 17:41:01 +0900 Subject: [PATCH] ing --- subscribe/auth_subscriber_handlers.go | 12 ++++++------ subscribe/probe_subscriber_handlers.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/subscribe/auth_subscriber_handlers.go b/subscribe/auth_subscriber_handlers.go index 44a4f62..7f34da7 100644 --- a/subscribe/auth_subscriber_handlers.go +++ b/subscribe/auth_subscriber_handlers.go @@ -21,10 +21,10 @@ type authSubscriberHandlers struct { ctx context.Context } -func (h *authSubscriberHandlers) OnSubscribe(payload string) { - uid := "kdkdkd" - channel := "auth" - soc := server.GetSocket(channel, uid) - - soc.Write([]byte(payload)) +func (h *authSubscriberHandlers) OnSubscribe(channel string, message ofs.SubscribeMessage) { + for _, uid := range message.Targets { + if soc := server.GetSocket(channel, uid); nil != soc { + soc.Write(message.Message) + } + } } diff --git a/subscribe/probe_subscriber_handlers.go b/subscribe/probe_subscriber_handlers.go index 722487e..34ae792 100644 --- a/subscribe/probe_subscriber_handlers.go +++ b/subscribe/probe_subscriber_handlers.go @@ -21,10 +21,10 @@ type probeSubscriberHandlers struct { ctx context.Context } -func (h *probeSubscriberHandlers) OnSubscribe(payload string) { - uid := "kdkdkd" - channel := "auth" - soc := server.GetSocket(channel, uid) - - soc.Write([]byte(payload)) +func (h *probeSubscriberHandlers) OnSubscribe(channel string, message ofs.SubscribeMessage) { + for _, uid := range message.Targets { + if soc := server.GetSocket(channel, uid); nil != soc { + soc.Write(message.Message) + } + } }