Hi,
I am creating a web site on which I need a notification/chat system
(only the notification system is really important).
Each user authenticates itself before accessing to the web site, and
has a specific XMPP account.
The XMPP account is created when the user creates his account on the
web site, and he doesn't even know he has one.
At first, the web site was using one single page and filing content
with AJAX.
I installed Ejaberd and Strophe, and all was working fine.
The web site is now changing a bit and users will navigate between
pages.
As the BOSH authent is quite long, I tried to use the attach()
function of Strophe with a PHP script (similar to the one I saw on
this group) that takes care of all the XMPP-BOSH login part (this
works fine).
The second step is to allow users to change page, reload, switch
between tabs, etc..., using the same BOSH
session (jid, rid, sid).
The problem is I have to maintain a correct rid between all the
Strophe of all pages : I made a few tests using this technique :
Every time the pages looses focus or click is made on a link, the page
updates rid in the phpsession using a specific php script, and pause()
Strophe. On page load/focus, the rid is downloaded with the same
script and attach() or resume().
It works... most of the time, which is not enough.
I have some ideas I wanted to share to have feedbacks (and other
solutions I didn't think of) :
--
1) Every page opens a new session (using a php script to create
session).
This takes around 300-500ms and can be made after displaying the page.
My problem is I don't know how the Ejabberd server will react with so
much authentications. The website will have between 300-700
simultaneous users so this could mean around 50 authent per second
with this technique.
2) Using the http-prebind patch for Ejabberd
I saw two of them : one is using anonymous auth (can't use it), the
other is using http basic auth.
I could pass basic auth with js, but I would have the same problem
than in 1) about the ejabberd load.
The other problem is I don't know erlang and the project (https://
github.com/skeltoac/http_prebind) doesn't seem active.
3) Try to find another technique to store rid (I saw someone using the
local storage, maybe cookies)
and patch Strophe to get rid before every call.
LocalStorage is not supported by all browser thow.
4) Create a XMPP "proxy" which will :
Take care af the authent process (using php session parameters set up
dring web login process), and maintain a session active (with specific
timeout).
Modify rid on the fly from the web client to the ejabberd
This solves all my problems but such a thing doesn't exists so it will
take some time to write (but less than coding a new Ejabberd+Strophe).
(I know the best way would be to write this in Erlang and attach it to
Ejabberd but it would take to much time for me to learn Erlang enough
to do something like this).
--
Have any of you tried one of these techniques ? Do you have other
ideas ?
Thanks in advance,
Patrick