Pregunta

I've implemented a web based instant messaging / chat feature using http binding and ejabberd. For the lazy here's the short version of my question:

How would you go about implementing a web based XMPP chat client which could be displayed in multiple browser windows simultaneously, each displaying an identical view of the open chats?

More detailed ramblings for those who care:

One potential solution would be to just let every tab manage it's own connection. XMPP has decent enough support for multiple clients so let it do the routing. I have at least 2 issues with this solution. 1 is the obvious increase in bandwidth consumption this would cause. 2 is the current lack of support for multiple clients with the same JID to connect to MUC rooms in ejabberd. This will apparently be implemented for 3.1 but it's a major issue for me as it stands.

Initially I wondered if there might be some flash magic involved but it seems the swf on the page is only used to play the notification sound effects. You can confirm this by using firebug or similar to delete the embed tag. The chat feature still works.

This basically leaves me with cookies as the only way to share between the tabs. In this scenario a master tab would dump all messages to cookies which could be polled from other tabs. This seems quite ridiculous to me as the poll frequency would have to be exceptionally high to avoid any latency. What would happen when the 'master' window was closed?

I've seen this done by more than one site and normally when I look at problems like these I can at least understand at least vaguely how I'd go about it but I don't mind admitting this one has got me stumped.

¿Fue útil?

Solución

So I've poked around in facebook chat a little more and it seems that they are just letting every tab manage it's own connection. Ejabberd puts several hurdles in my way to achieve this with MUC rooms so I guess that's why I was inclined to discount this solution initially. I think private messaging only should be more straightforward for anyone else interested.

The issue with multiple MUC instances is https://support.process-one.net/browse/EJAB-305

I guess I'l have to make a case for patching ejabberd. If anyone has any other observations I'd love to hear them.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top