plugins/mod_bosh.lua
changeset 8526 30671b378ab5
parent 8496 d424fe42b4d2
child 8527 81fff93d3bc6
equal deleted inserted replaced
8525:073e517a1487 8526: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