mod_http_pre_bind for ejabberd.
When using anonymous users the authentication process through BOSH can
take a second or two. These seconds can be saved by doing all of the
authentication and bosh session setup on one call. mod_http_pre_bind
does this and returns a jid,sid, and rid of a valid BOSH session.
It requires mod_http_bind. Modifications are needed to mod_http_bind. The
start, http_put, handle_session_start, and prepare_response functions need
to be made public in the module code. This prebind module simply calls those
functions to initiate and handle a session.
To build run the build.sh script and install the resulting beam files
in your ejabberd ebin directory.
Install both in ejabberd.cfg.
{5288, ejabberd_http, [
http_bind,
web_admin,
{request_handlers,
[{["http-pre-bind"],
mod_http_pre_bind}]}
]}
%%
%% Modules enabled in all ejabberd virtual hosts.
%%
{modules,
[
{mod_http_bind, []},
{mod_http_pre_bind, []},
Example post and response:
POST
<body to='example.com' rid='1234567' wait='60' hold='1' />
Response:
<body xmlns='http://jabber.org/protocol/httpbind'
sid='892efca20cea238958f0603f89a6f8472ef790fe'
rid='1234568'>
<iq xmlns='jabber:client'
id='_bind_auth_2'
type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>[email protected]/37436661951260831658614586</jid>
</bind>
</iq>
</body>