Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Mon Sep 06 23:21:25 2021 +0200 +++ b/plugins/mod_websocket.lua Mon Jun 21 22:50:23 2021 +0200 @@ -348,18 +348,20 @@ end end -module:hook("c2s-read-timeout", keepalive, -0.9); - -module:depends("http"); -module:provides("http", { - name = "websocket"; - default_path = "xmpp-websocket"; - route = { - ["GET"] = handle_request; - ["GET /"] = handle_request; - }; -}); - function module.add_host(module) module:hook("c2s-read-timeout", keepalive, -0.9); + + module:depends("http"); + module:provides("http", { + name = "websocket"; + default_path = "xmpp-websocket"; + route = { + ["GET"] = handle_request; + ["GET /"] = handle_request; + }; + }); + + module:hook("c2s-read-timeout", keepalive, -0.9); end + +module:add_host();