Search code examples
sessionxmppuser-presence

XMPP to show presence and without login in a web application?


The main problem is, how would you ensure people can login to the xmpp server securely without having to login again from the web app login page?


Solution

  • I assume that you want to send a <presence/> stanza indicating that the user is available. In that case, you need to instantiate a new session, either by logging in manually, or other means.

    If you want to automatically login a user and start up the application, try using localStorage, then triggering login so that it seems like the user did not login.

    If you wanted to send a <presence><show>chat</show></presence> or something akin to that, you might be able to get away with using a preexisting BOSH connection. The problem with that is you won't presence from JIDs in the roster because no probes were sent out.

    I recommend the first solution. The second is there more for informational purposes than anything else. And if push comes to shove, go to http://xmpp.org. Look through BOSH XEP (if you are using it), RFC 3920 (XMPP Core) and RFC 3921 (XMPP IM).