Software /
code /
prosody
Changeset
7316:62d533535334
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 24 Mar 2016 13:57:58 +0100 |
parents | 7313:316ca5c15255 (current diff) 7315:4fd984d1e445 (diff) |
children | 7318:1fa6052f3a07 |
files | |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Wed Mar 23 12:19:23 2016 +0000 +++ b/plugins/mod_websocket.lua Thu Mar 24 13:57:58 2016 +0100 @@ -226,8 +226,7 @@ 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 @@ 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 @@ ["GET /"] = handle_request; }; }); + module:hook("c2s-read-timeout", keepalive, -0.9); end