aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_websocket.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-03-24 13:57:58 +0100
committerKim Alvefur <zash@zash.se>2016-03-24 13:57:58 +0100
commit1c4e23ccddeffdc45eb6de28460205f5da7fab82 (patch)
treed6ebdfc4aefc67d749aa7322ce910b83c4119f47 /plugins/mod_websocket.lua
parent6ba752537d94d555b84862d99fe57d883d94f724 (diff)
parent921c69533820f54eea04a84f043eddb156482f92 (diff)
downloadprosody-1c4e23ccddeffdc45eb6de28460205f5da7fab82.tar.gz
prosody-1c4e23ccddeffdc45eb6de28460205f5da7fab82.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_websocket.lua')
-rw-r--r--plugins/mod_websocket.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua
index 274e587a..086eab62 100644
--- a/plugins/mod_websocket.lua
+++ b/plugins/mod_websocket.lua
@@ -226,8 +226,7 @@ function handle_request(event)
frame.opcode = 0xA;
conn:write(build_frame(frame));
return "";
- elseif opcode == 0xA then -- Pong frame
- module:log("warn", "Received unexpected pong frame: " .. tostring(frame.data));
+ elseif opcode == 0xA then -- Pong frame, MAY be sent unsolicited, eg as keepalive
return "";
else
log("warn", "Received frame with unsupported opcode %i", opcode);
@@ -291,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", {
@@ -301,4 +306,5 @@ function module.add_host(module)
["GET /"] = handle_request;
};
});
+ module:hook("c2s-read-timeout", keepalive, -0.9);
end