Lately I came across to playing around with XMPP Over Websockets. The objective was to get something like page transitions working for Websockets as well as they do with BOSH. With page transitions I mean being able to integrate some XMPP client into a web site that still has the old habit of loading new pages every time new content needs to be displayed. You know this thing with hyperlinks, what we did when we were young. Anyway, in such a case a XMPP client must be able to store it’s state upon unloading a page and restore it once the new page is being loaded. This also applies to the underlying XMPP stream the client is attached to.
The current proposal of XMPP Over Websockets does not support this scenario as the websocket is within a 1:1 relationship to the c2s session (aka the XMPP stream). So upon unloading a page the websocket would be closed and as such the c2s session would have to be terminated as well. So I introduced the notion of a websocket session that manages the underlying XMPP stream and allows websockets being attached to it. The idea was to use session IDs that are being stored at a cookie being sent of the websocket.
So probably we’ll come up with a solution that deals with those situations at the stream level itself using XEP-0198 – Stream Management. To make this work with XMPP Over Websockets there will be slight changes to the draft that allow to not close the stream immediately after closing the websockets but uses some predefined timeout instead.