Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 7315:4fd984d1e445
mod_websocket: Send a ping on read timeout
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 23 Mar 2016 23:21:03 +0100 |
parent | 7314:e327e5b592f5 |
child | 7340:7dea28dafc49 |
comparison
equal
deleted
inserted
replaced
7314:e327e5b592f5 | 7315:4fd984d1e445 |
---|---|
288 response.headers.access_control_allow_origin = cross_domain; | 288 response.headers.access_control_allow_origin = cross_domain; |
289 | 289 |
290 return ""; | 290 return ""; |
291 end | 291 end |
292 | 292 |
293 local function keepalive(event) | |
294 return conn:write(build_frame({ opcode = 0x9, })); | |
295 end | |
296 | |
297 module:hook("c2s-read-timeout", keepalive, -0.9); | |
298 | |
293 function module.add_host(module) | 299 function module.add_host(module) |
294 module:depends("http"); | 300 module:depends("http"); |
295 module:provides("http", { | 301 module:provides("http", { |
296 name = "websocket"; | 302 name = "websocket"; |
297 default_path = "xmpp-websocket"; | 303 default_path = "xmpp-websocket"; |
298 route = { | 304 route = { |
299 ["GET"] = handle_request; | 305 ["GET"] = handle_request; |
300 ["GET /"] = handle_request; | 306 ["GET /"] = handle_request; |
301 }; | 307 }; |
302 }); | 308 }); |
303 end | 309 module:hook("c2s-read-timeout", keepalive, -0.9); |
310 end |