From 884cba24e02ae905404321fad50a9d6898383f94 Mon Sep 17 00:00:00 2001 From: David Costa Faidella Date: Fri, 23 Nov 2012 12:29:59 +0000 Subject: [PATCH] If the command is a SUBSCRIBE or a PSUBSCRIBE, the keep alive should be 1, keeping the connection alive from the web socket and enabling the client to manage its lifecycle. This seems to do the trick but I don't know enough about the webdis architecture as to guarantee that there are no side effects. But so far seems to do the trick. --- websocket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/websocket.c b/websocket.c index 920f0b2..ff5cd70 100644 --- a/websocket.c +++ b/websocket.c @@ -364,6 +364,10 @@ ws_reply(struct cmd *cmd, const char *p, size_t sz) { /* send WS frame */ r = http_response_init(cmd->w, 0, NULL); + if (cmd_is_subscribe(cmd)) { + r->keep_alive = 1; + } + if (r == NULL) return -1;