Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 8523:30671b378ab5
mod_bosh: Make into a normal module (fixes #402)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 13 Dec 2017 15:24:02 +0100 |
| parents | d424fe42b4d2 |
| children | 81fff93d3bc6 |
comparison
equal
deleted
inserted
replaced
| 8522:073e517a1487 | 8523:30671b378ab5 |
|---|---|
| 3 -- Copyright (C) 2008-2010 Waqas Hussain | 3 -- Copyright (C) 2008-2010 Waqas Hussain |
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | |
| 9 module:set_global(); -- Global module | |
| 10 | 8 |
| 11 local hosts = _G.hosts; | 9 local hosts = _G.hosts; |
| 12 local new_xmpp_stream = require "util.xmppstream".new; | 10 local new_xmpp_stream = require "util.xmppstream".new; |
| 13 local sm = require "core.sessionmanager"; | 11 local sm = require "core.sessionmanager"; |
| 14 local sm_destroy_session = sm.destroy_session; | 12 local sm_destroy_session = sm.destroy_session; |
| 510 <p>It works! Now point your BOSH client to this URL to connect to Prosody.</p> | 508 <p>It works! Now point your BOSH client to this URL to connect to Prosody.</p> |
| 511 <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> | 509 <p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p> |
| 512 </body></html>]]; | 510 </body></html>]]; |
| 513 }; | 511 }; |
| 514 | 512 |
| 515 function module.add_host(module) | 513 module:depends("http"); |
| 516 module:depends("http"); | 514 module:provides("http", { |
| 517 module:provides("http", { | 515 default_path = "/http-bind"; |
| 518 default_path = "/http-bind"; | 516 route = { |
| 519 route = { | 517 ["GET"] = GET_response; |
| 520 ["GET"] = GET_response; | 518 ["GET /"] = GET_response; |
| 521 ["GET /"] = GET_response; | 519 ["OPTIONS"] = handle_OPTIONS; |
| 522 ["OPTIONS"] = handle_OPTIONS; | 520 ["OPTIONS /"] = handle_OPTIONS; |
| 523 ["OPTIONS /"] = handle_OPTIONS; | 521 ["POST"] = handle_POST; |
| 524 ["POST"] = handle_POST; | 522 ["POST /"] = handle_POST; |
| 525 ["POST /"] = handle_POST; | 523 }; |
| 526 }; | 524 }); |
| 527 }); | |
| 528 end |
