Comparison

plugins/mod_bosh.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 11733:27699cc148df
child 11808:c24580a214f3
comparison
equal deleted inserted replaced
11770:d2a9aa1c7ac8 11771:4c0802b52673
541 warning = not (consider_bosh_secure or event.request.secure) and "This endpoint is not considered secure!" or nil; 541 warning = not (consider_bosh_secure or event.request.secure) and "This endpoint is not considered secure!" or nil;
542 -- <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> 542 -- <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p>
543 }) or "This is the Prosody BOSH endpoint."; 543 }) or "This is the Prosody BOSH endpoint.";
544 end 544 end
545 545
546 module:depends("http"); 546 function module.add_host(module)
547 module:provides("http", { 547 module:depends("http");
548 default_path = "/http-bind"; 548 module:provides("http", {
549 route = { 549 default_path = "/http-bind";
550 ["GET"] = GET_response; 550 route = {
551 ["GET /"] = GET_response; 551 ["GET"] = GET_response;
552 ["POST"] = handle_POST; 552 ["GET /"] = GET_response;
553 ["POST /"] = handle_POST; 553 ["POST"] = handle_POST;
554 }; 554 ["POST /"] = handle_POST;
555 }); 555 };
556 });
557 end
558
559 module:add_host();