Advice to Santa on fast presence delivery

I know, it’s too long to go until Christmas, but I couldn’t avoid such a juicy pun.

One of the things I don’t much like about the user experience of XMPP is that when you first connect, you need to wait a surprisingly long time for remote presence to filter back to you. To my mind, it makes the login sequence seem particularly sluggish, as you get presence dribble back, as contacts’ servers respond to the probes one by one. This contrasts greatly with the large monolithic networks, where the network has total knowledge of the entire state.

This does, of course, get considerably worse when running over low bandwidth and otherwise constrained S2S links, and so I managed to kid myself reasonably successfully that it was worth looking at as something fun to do inside Isode M-Link.

Now, servers send the basic available/unavailable presence states all around the network anyway – the intermediate presence updates needn’t be sent unless the contacts are online, but the binary available state is always transmitted. Servers offering PEP need to track this presence, too, in order to send the right Lovely PEP Goodness™ out to your contacts, even if you’re offline. So it seemed to me that we might be able to leverage this.

Unfortunately, it turns out to be not as simple as I’d hoped – while servers do, by and large, try to send the right things, all manner of things can go wrong. Servers crash, or the network drops, or simply the TCP session dies and there’s no XEP-0198 to save the day. To get to the point, we might be left thinking a contact is online, when in fact they’re not – and moreover, their server may not respond to probes with an unavailable. Also, even if they do respond with unavailable, your client might not understand that to mean “all the contacts’ resources are offline”, and leave them displaying online presence if they have some to display already.

However, many of these problems turn out to exist in the wild anyway – while your client might never notice, your server can easily be quietly building up PEP subscription filters. So we developed a probe time-out, which removes older defunct presence, and we also re-probe during a long running session to ensure we keep presence refreshed, and synthesize unavailable presence in order to keep the client synchronised with our view of the universe, even if we get a bare-jid unavailable mid-session.

With these, it becomes pretty easy to then send the client our internal view of their contacts’ presence when they send their initial presence – really just as we do for the local contacts – which means that the user experience seems to be that you log in and instantly get your contacts’ status.

Of course, we still send probes out initially, and they get responded to. This means that as the session goes on, we’ll “refine” the view of the client as we get feedback. This is great, but between this and the re-probing, there’s a considerable amount of redundant presence stanzas flying about between sessions.

Presence is (or should be) a state, rather than a message, so if you get a presence stanza that’s the same as the last one you got from that contact, it’s basically telling you nothing – so I experimented with throwing away duplicate presence. Pleasingly, this works fine – the clients don’t get the duplicate presence, they only get it when it changes.

So now, the client are getting a view of the presence that’s not only consistent with the server’s, but also carefully maintained. And they get this view pretty much instantly, in one giant packet at the beginning of the session – with the comparatively rare update views sometimes filtering in afterward. The net result? On a modern M-Link – with the right options set – presence behaves like XMPP were one giant network, instead of lots of federated servers. In addition, there’s less connection between probes and the sender’s presence state, making certain ideas on presence leaks harder to exploit.

I think it’s one more step toward making XMPP a more cohesive network than the monolithic networks themselves.


On protocol design

Mark Crispin. Quoted in full. Part of a longer thread, which isn’t of as broad interest. I don’t always agree with Mark’s point of view. But on LinkedIn, whilst I said Mark’s opinions were strong (perhaps too strong), I also said they are always – always – worth consideration. This is a perfect case in


Password Rules, OK?

I’ve been catching up on things, and as well as moderating several month old comments on here, I’ve also stumbled across a school photo, which had me wondering what ever happened to the people in it. One of them is Alex Guest, who’s now running an interesting-looking TV project, but also posted about password security


WebSchlockets

Andy Green, over at Way of the Exploding Head has a brief note explaining the interesting and ongoing car crash that is WebSockets. The actual security issue is that some proxies are known to treat all traffic on port 80 as HTTP traffic, and furthermore, by inconsistently treating the request by name and by IP


I have become Dave, destroyer of disks

Both my wife and my mother work for charities, and from both of them, I’ve ended up with a couple of machines in my office with sensitive data on the disk. Now, given I work for Isode, and given who we sell to, you might think this is run of the mill, but it’s not


This time, it’s personal

PEP – the Personal Eventing Protocol – has long been seen as a poor cousin of XEP-0060, XMPP’s Publish/Subscribe protocol. PEP is mandated to support a fairly small subset of PubSub, just enough for the rich-presence services it’s generally used for today. As part of my work, I’ve been building up our existing PubSub implementation


Dialback. Now without dialback.

In the real world, XMPP servers on the Internet authenticate each other via XEP-0220 Dialback. What happens is that a calling server provides a unique key, and the callee dials back to the caller’s domain and asks whether it’s valid. From a security standpoint, this is better than nothing – servers are effectively trusting the


A truly social network

As a social network, Buddycloud might be thought of as catering to a niche market. The Buddycloud client is mobile – historically only for Symbian – and there’s a strong relationship to geolocation. You’d be entirely forgiven for thinking it’s possible the most specialist and purpose-specific social network in the world, and heaven knows that


Optimizing caps a bit more

Occasionally, I find the time to try out something a little unusual in XMPP. It’s one of the benefits of having your own server to tinker with. Although it’s unlikely this particular item will reach an actual release before next year, I thought I’d share. There was a thread on jdev a while back which


Violating Layers

There’s a raging argument going on in WebSocketLand (ie, the hybi@ietf.org list), between Shelby Moore and – well – everyone, about layered designs in protocols. I shared my views, but I thought it might be interesting to some of you lot, my imaginary readers, so I repost here. To give you some context, the subject