Compare commits
2 Commits
ff408fd394
...
2c00022622
Author | SHA1 | Date |
---|---|---|
Nguyen Minh | 2c00022622 | |
Nguyen Minh | afd6b215d6 |
|
@ -0,0 +1,21 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"git.selly.red/Selly-Modules/natsio"
|
||||
"git.selly.red/Selly-Modules/natsio/model"
|
||||
"git.selly.red/Selly-Modules/natsio/subject"
|
||||
)
|
||||
|
||||
// Socket ...
|
||||
type Socket struct{}
|
||||
|
||||
// GetSocket ...
|
||||
func GetSocket() Socket {
|
||||
return Socket{}
|
||||
}
|
||||
|
||||
// EmitSocketEventDataReward ...
|
||||
func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error {
|
||||
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
|
||||
return err
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package model
|
||||
|
||||
// PayloadEmitSocketEvent ...
|
||||
type PayloadEmitSocketEvent struct {
|
||||
User string `json:"user"`
|
||||
Message string `json:"message"`
|
||||
Data string `json:"data"`
|
||||
IsNotRemove bool `json:"isNotRemove"`
|
||||
}
|
|
@ -23,6 +23,7 @@ var prefixes = struct {
|
|||
Affiliate string
|
||||
Product string
|
||||
Queue string
|
||||
Socket string
|
||||
}{
|
||||
Communication: "communication",
|
||||
Order: "order",
|
||||
|
@ -46,4 +47,5 @@ var prefixes = struct {
|
|||
Affiliate: "affiliate",
|
||||
Product: "product",
|
||||
Queue: "queue",
|
||||
Socket: "socket",
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package subject
|
||||
|
||||
import "fmt"
|
||||
|
||||
func getSocketValue(val string) string {
|
||||
return fmt.Sprintf("%s.%s", prefixes.Socket, val)
|
||||
}
|
||||
|
||||
// Socket ...
|
||||
var Socket = struct {
|
||||
EmitEventReward string
|
||||
}{
|
||||
EmitEventReward: getSocketValue("emit_event_reward"),
|
||||
}
|
Loading…
Reference in New Issue