2023-03-23 03:34:58 +00:00
|
|
|
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
|
|
|
|
}
|
2023-03-27 08:44:39 +00:00
|
|
|
|
|
|
|
// EmitEventToUser ...
|
|
|
|
func (s Socket) EmitEventToUser(p model.PayloadEmitSocketEvent) error {
|
|
|
|
_, err := natsio.GetServer().Request(subject.Socket.EmitEventToUser, toBytes(p))
|
|
|
|
return err
|
|
|
|
}
|