Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 11771:4c0802b52673
mod_bosh,mod_websocket: Make into global-shared modules (...again)
Global modules aren't quite considered loaded onto hosts, which
causes confusion in some cases. They are also reported in the log as
being served on http://*:5280/foo which is also a bit confusing, and
can't be clicked.
Global modules also have to have their paths configured in the global
section, which could be confusing and unexpected.
This global+shared method should be the best of both worlds.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 21 Jun 2021 22:50:23 +0200 |
parent | 11560:3bbb1af92514 |
child | 11868:ae093c259da2 |
comparison
equal
deleted
inserted
replaced
11770:d2a9aa1c7ac8 | 11771:4c0802b52673 |
---|---|
346 if session.open_stream == session_open_stream then | 346 if session.open_stream == session_open_stream then |
347 return session.conn:write(build_frame({ opcode = 0x9, FIN = true })); | 347 return session.conn:write(build_frame({ opcode = 0x9, FIN = true })); |
348 end | 348 end |
349 end | 349 end |
350 | 350 |
351 module:hook("c2s-read-timeout", keepalive, -0.9); | |
352 | |
353 module:depends("http"); | |
354 module:provides("http", { | |
355 name = "websocket"; | |
356 default_path = "xmpp-websocket"; | |
357 route = { | |
358 ["GET"] = handle_request; | |
359 ["GET /"] = handle_request; | |
360 }; | |
361 }); | |
362 | |
363 function module.add_host(module) | 351 function module.add_host(module) |
364 module:hook("c2s-read-timeout", keepalive, -0.9); | 352 module:hook("c2s-read-timeout", keepalive, -0.9); |
365 end | 353 |
354 module:depends("http"); | |
355 module:provides("http", { | |
356 name = "websocket"; | |
357 default_path = "xmpp-websocket"; | |
358 route = { | |
359 ["GET"] = handle_request; | |
360 ["GET /"] = handle_request; | |
361 }; | |
362 }); | |
363 | |
364 module:hook("c2s-read-timeout", keepalive, -0.9); | |
365 end | |
366 | |
367 module:add_host(); |