I would like to use a single shared TCP/IP socket to simultaneously host the authenticated presence of multiple resources with different jids/resourcenames.
For example email@example.com/agent1 and firstname.lastname@example.org/agent1 and email@example.com/agent1 would all share a single client socket connected to the same server, over which auth and presence stanzas for the multiple endpoints would be passed. This socket would be simultaneously able to handle inbound and outbound stanzas on behalf of the multiple authenticated XMPP endpoints it hosts.
Is this socket reuse technically impossible based on the XMPP protocol? If it’s impossible with XMPP we may have to drop it in favour of AQMP or similar in the architecture I’m specifying.
If it’s possible in XMPP I certainly can’t find a way to do it with Smack, (each XMPPConnection can authenticate against only one JID at a time). Does anyone know how to do this?
I’m looking into this as part of a scalable server built on diet-agents, http://diet-agents.sourceforge.net , which can host hundreds of thousands of individually addressable processes on a single machine with a few threads and a single TCP connection.
I would like to be able to address these individual processes or ‘agents’ as uniquely named XMPP endpoints to make wide area coordination easier from other machines independently of language or platform (diet-agents itself requires Java so isn’t suitable on all machines).
However, requiring one TCP/IP socket per XMPP endpoint/agent is a huge step backwards for our scalability, taking the required server resources from a single socket to potentially hundreds of thousands of sockets to host the same number of addressable endpoints.
It would be better to have a single thread waiting on a single XMPP socket which serves multiple agents, wakes them up to handle incoming messages, and sends outbound messages on their behalf using XMPP stanzas.
So far I’ve using one JID per Socket with multiple anonymous identities in different chatrooms, but these identities are not full-fledged Jabber identities, and hence we lose a lot of the benefits of using Jabber in the first place - no Rosters, no Private XML, no Presence etc.
Also, this approach breaks the security model of individual JIDs mapping to individual ‘user’ entities, meaning the server would be unable to handle privacy issues properly.
Grateful for your thoughts if you have the time to read this message.