projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f703974
)
mod_websocket: Send a ping on read timeout
author
Kim Alvefur
<zash@zash.se>
Wed, 23 Mar 2016 22:21:03 +0000
(23:21 +0100)
committer
Kim Alvefur
<zash@zash.se>
Wed, 23 Mar 2016 22:21:03 +0000
(23:21 +0100)
plugins/mod_websocket.lua
patch
|
blob
|
history
diff --git
a/plugins/mod_websocket.lua
b/plugins/mod_websocket.lua
index ecbfabddf77c535e638c1ac0d5fc977508ba2278..086eab62603bde1de809829bdbc0bf493559d340 100644
(file)
--- 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