From ec90f20e1fa9fd021d31b8730d773b90a313fbae Mon Sep 17 00:00:00 2001 From: Gennadii Kovalev Date: Fri, 27 May 2016 14:51:37 +0200 Subject: [PATCH] send. allow "nil" arguments to send, emit, broadcast --- send.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/send.go b/send.go index 7f87601..38c51f9 100644 --- a/send.go +++ b/send.go @@ -16,12 +16,14 @@ var ( Send message packet to socket */ func send(msg *protocol.Message, c *Channel, args interface{}) error { - json, err := json.Marshal(&args) - if err != nil { - return err - } + if args != nil { + json, err := json.Marshal(&args) + if err != nil { + return err + } - msg.Args = string(json) + msg.Args = string(json) + } command, err := protocol.Encode(msg) if err != nil {