Nadya Peek

Federating Social Networks

on XMPP

When you decide to visit a website in your favorite browser, you type an http address. That address points to a server, and your browser opens a connection to pull the site off that server. Once the site is fully loaded, the connection closes.

When you decide to fire up google talk and talk to a friend, your XMPP server finds the address associated with your friend's (jabber) ID and opens a connection to him. This connection stays open, so when you type something, you don't have to wait for his chat client to decide to check whether you posted something. You send it to him directly.

HTTP can also do some kind of persistent connection, but it's hacky. HTTP servers are not made for persistent connections, and they don't scale. HTTP persistent connections also lack addressability: it is unclear which user is connected to an http connection, while users connected to an XMPP server need to authenticate with their jabber IDs.

PubSub: don't pull, push!

Using XMPP, we don't only have to send chat messages. In fact, we can send whatever we want: vcards, audio, flickr enclosures. We want to use XMPP to send XML stanzas containing our anyMeta things from server to server. To do this, will use a publication and subscribe method (PubSub). We can have publishers and subscribers, where a publisher sends a notification to a subscriber each time there is a new stanza to transmit.

Enlarge

fsn xmpps2s - Nadya Peek

What does an XMPP message look like?

There are three types of of XMPP messages: a message, an i.q. or identification query (for subscribing, unsubscribing and error messages) and a presence {online, offline, busy}. A message will be what we use to move data from website to website. A message contained in a node, which is what you subscribe to to receive the message. The message is then one of the node items, with its own ID, title and content. It can also contain audio, flickr enclosures or location, whatever you want. Besides containing node items, the node itself also has a node ID and to and from IDs.

What if I don't have my own XMPP server?

You could also use PubSub as an external service for people who do not have access to an XMPP server.