send. allow "nil" arguments to send, emit, broadcast
This commit is contained in:
parent
79023de6ce
commit
ec90f20e1f
2
send.go
2
send.go
|
@ -16,12 +16,14 @@ var (
|
|||
Send message packet to socket
|
||||
*/
|
||||
func send(msg *protocol.Message, c *Channel, args interface{}) error {
|
||||
if args != nil {
|
||||
json, err := json.Marshal(&args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg.Args = string(json)
|
||||
}
|
||||
|
||||
command, err := protocol.Encode(msg)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue