From a432e7fd44f2c316a8e1c26ab9027ed39cbe1002 Mon Sep 17 00:00:00 2001 From: Sinh Date: Mon, 27 Mar 2023 15:44:39 +0700 Subject: [PATCH] update socket client --- client/socket.go | 6 ++++++ subject/socket.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/client/socket.go b/client/socket.go index 6c0a125..5ea589f 100644 --- a/client/socket.go +++ b/client/socket.go @@ -19,3 +19,9 @@ func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error _, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p)) return err } + +// EmitEventToUser ... +func (s Socket) EmitEventToUser(p model.PayloadEmitSocketEvent) error { + _, err := natsio.GetServer().Request(subject.Socket.EmitEventToUser, toBytes(p)) + return err +} diff --git a/subject/socket.go b/subject/socket.go index dae77c1..7a51789 100644 --- a/subject/socket.go +++ b/subject/socket.go @@ -9,6 +9,8 @@ func getSocketValue(val string) string { // Socket ... var Socket = struct { EmitEventReward string + EmitEventToUser string }{ EmitEventReward: getSocketValue("emit_event_reward"), + EmitEventToUser: "send_message_to_socket", }