From 58e9c55d8e82abbc9233ddb1e3c11007983c6d36 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 23 Feb 2017 15:29:38 +0200 Subject: [PATCH] Use simple PING for compatibility --- pubsub.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubsub.go b/pubsub.go index 29a68239..d183c70a 100644 --- a/pubsub.go +++ b/pubsub.go @@ -98,10 +98,10 @@ func (c *PubSub) Close() error { return c.base.Close() } -func (c *PubSub) Ping(payload string) error { +func (c *PubSub) Ping(payload ...string) error { args := []interface{}{"PING"} - if payload != "" { - args = append(args, payload) + if len(payload) == 1 { + args = append(args, payload[0]) } cmd := NewCmd(args...) @@ -239,7 +239,7 @@ func (c *PubSub) receiveMessage(timeout time.Duration) (*Message, error) { errNum++ if errNum < 3 { if netErr, ok := err.(net.Error); ok && netErr.Timeout() { - err := c.Ping("hello") + err := c.Ping() if err != nil { internal.Logf("PubSub.Ping failed: %s", err) }