It's always been our opinion that the closer to the socket layer an application can get, the more efficient your application can be. A Jabber session is really just pairs of full duplexed socketsone at the Jabber server for each client, one at each of the clients. (Actually, it's better to think in terms of endpoints rather than clients because endpoints can be anything from traditional conversational client GUIs to Internet services.)
The down side is that you will have to do a lot more management of the conversation. By custom, a Jabber session is a TCP session on port 5222 (or 5223 if SSL encryption is turned on). As Figure 1.1 shows, a session is in effect until the socket is closed by one of the parties.
A session can be conceived as a bi-directional stream of XML constantly being analyzed for content and correctness by either clients or servers. Structurally, a client really is an XML stream reader in the manner as a typical application built on an XML SAX or stream parser, where the application's actions are event drivenevents being triggered by tokens in the received XML stream.