diff --git a/internal/server/live.go b/internal/server/live.go index 0331594a..ab1d6410 100644 --- a/internal/server/live.go +++ b/internal/server/live.go @@ -8,6 +8,7 @@ import ( "net" "sync" + "github.com/tidwall/redcon" "github.com/tidwall/tile38/internal/log" ) @@ -160,9 +161,9 @@ func (server *Server) goLive( var livemsg []byte switch outputType { case JSON: - livemsg = []byte(`{"ok":true,"live":true}`) + livemsg = redcon.AppendBulkString(nil, `{"ok":true,"live":true}`) case RESP: - livemsg = []byte("+OK\r\n") + livemsg = redcon.AppendOK(nil) } if err := writeLiveMessage(conn, livemsg, false, connType, websocket); err != nil { return nil // nil return is fine here diff --git a/internal/server/pubsub.go b/internal/server/pubsub.go index d6d8ff3e..4cdf0b8f 100644 --- a/internal/server/pubsub.go +++ b/internal/server/pubsub.go @@ -194,7 +194,7 @@ func (c *Server) liveSubscription( write := func(data []byte) { writeLock.Lock() defer writeLock.Unlock() - writeLiveMessage(conn, data, false, connType, websocket) + writeLiveMessage(conn, data, outputType == JSON, connType, websocket) } writeOK := func() { switch outputType {