aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-03-23 23:21:03 +0100
committerKim Alvefur <zash@zash.se>2016-03-23 23:21:03 +0100
commit921c69533820f54eea04a84f043eddb156482f92 (patch)
treeb9bd3c72112d0721897cdcb03bcbb2f17119bd09 /plugins
parentb69db0deff59327a43d498006ca48feca2abd712 (diff)
downloadprosody-921c69533820f54eea04a84f043eddb156482f92.tar.gz
prosody-921c69533820f54eea04a84f043eddb156482f92.zip
mod_websocket: Send a ping on read timeout
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_websocket.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua
index ecbfabdd..086eab62 100644
--- a/plugins/mod_websocket.lua
+++ b/plugins/mod_websocket.lua
@@ -290,6 +290,12 @@ function handle_request(event)
return "";
end
+local function keepalive(event)
+ return conn:write(build_frame({ opcode = 0x9, }));
+end
+
+module:hook("c2s-read-timeout", keepalive, -0.9);
+
function module.add_host(module)
module:depends("http");
module:provides("http", {
@@ -300,4 +306,5 @@ function module.add_host(module)
["GET /"] = handle_request;
};
});
+ module:hook("c2s-read-timeout", keepalive, -0.9);
end