Presence forwarding in Tigase - user's presence on the website

I have been asked a few times already how to share user's XMPP presence with some external system like a website for example. There are many ways to do this with Tigase, however, until now it required some additional code in the server to share the users' presence with other systems.

Wouldn't it be a great if you could just configure Tigase to share users' presence with your website?

I have just finished code implementation which allows you to share user's presence with other systems without adding any code in the server. It is just a matter of Tigase configuration to make it forward users' presence to JID address. Usually this JID is a bot attached to the system or it can also be a component (internal or external).

More details and usage description is available on the Tigase.IM website where our public Tigase service is running. The version installed there allows you to try it out without a need to run your own Tigase server.
Please refer to the article Presence forwarding for more details.

Article type: 
Application: 

Comments

Hi,

thats a nice feature, something that I sure hope to see on other servers. A couple of years back, the same was done at the place I used to work, using ejabberd.

But I still think this is a stopgap measure. What I would really love to see is XMPP servers exposing the internal events (not only presence but also login/logout, roster changes, vcard updates, private XML updates) as a XEP-0060 source.

That would be something way way better.

Actually, current solution does not prevent PubSub use. You could configure PubSub as a destination address. However, Tigase now sends just a presence notification, which would not be correctly handled by PubSub. We would need to transform these events into PubSub protocol. Not too difficult I guess, however, I have mixed feelings about exposing it all through PubSub.

Let's consider the simplest scenario - SessionManager is a publisher and sends to PubSub updates for all these events.

Tigase is usually deployed on a very large installations - 1mln or more online users. Users login rate is over 100/sec. Thousands of status changes per second. I do not see how PubSub could handle such a load in a reasonable way. Plus how could subscribers receive and handle all the traffic.

You can argue, the same applies to sending presence updates to the bot client. And this is partially true. In bot case, however, we send data and forget, in case the bot connection is overloaded we can drop some packets to prevent the whole system overloading.
PubSub, however, is more complex use case.

I think the load issue is a non-issue. If you really need the information, then you need to provision capacity to handle the load. Its a business decision.

I believe you can use XEP-0060 in "fire and forget mode" but I haven't looked at the spec in while and I might be mistaken.

My idea on using XEP-0060 for all of this is to provide a standard API across all servers for the same purpose, with a well-known semantics. With a standard XEP-0060, you could have multiple external entities (if permissions allow for it) getting the presence changes.

But back to the load issue. At the time we did this, we were seeing a peek of 10k presence changes per minute. Those were send to a JID, which we made available through XEP-0114 connections. We used multiple external components, sharing the same domain, load-balanced with the (at the time) private load-balancer module for ejabberd we commissioned. This is now a standard part of the ejabberd server btw.

It worked really well for us, although it was a smaller server than the one you mention.

Bottom line: its good to see some of the internal events of a XMPP server being exposed to external systems, it allows excellent integration with other business systems. I just hoped this could be done in a std way, nothing more.

Thank you for the suggestion. I think it is a good idea, and the point of the load is very valid too. Consider the current solution the first step.

I will think of PubSub usage for this kind of stuff as well.

That's a nice feature. I'm planning to publish the number of occupants in a room. Do you consider offering the forwarding for MUC room presence, too, or is there a better way to achieve this?

And also, i didn't see the way to create Presence forwarding address on my own Tigase server: http://www.tigase.im/content/presence-forwarding
Could you plz help me?
thank you.

Have you updated your installation to the latest version that includes this feature?

ya, i have just update to 5b2883. There is nothing happen. Could you plz explain more detail, how to create forwarding presence address?
thank you.

In my own Tigase server, i didn't see VHost Manager.
Also how can i create forwarding presence address, when installation, and i just have only 1 original domain. In your tutorial, i just see how to create it when create new domain.
Thank you.

You should be able to see VHost manager in service discovery when you use admin account (specified in init.properties). There is also no problem that you use one domain - each domain can be configured (even if there is only one pre-configured in init.properties)

I was wondering how can we set global forwarding address for tigase installation?

I looked into the code and found
PRESENCE_GLOBAL_FORWARD = "presence-global-forward" in Presence.java. where can I set this config setting?

Also I tried

--vhost = domain.com:pres-forw=component.domain.com

where component.domain.com is JID of external component. But it didnt receive any presence message. am I missing something here?