The Polyglot approach to the federated social web

How do you mean, polyglot?

A polyglot is someone who speaks multiple languages reasonably well. Imagine we want peace on earth, and we decide that the way to achieve it is to make sure everybody can talk to everybody. One approach to this would be to develop Esperanto: a common language that is easy to learn for everybody, regardless of their native language. So far, a lot of work on the federated social web has followed the Esperanto approach.

Another solution is to realise that we can be a network of friends first, regardless of which languages (if any) we have in common. Granted, if two people have no languages in common whatsoever, they can only wave and smile at each other and that's about it. But now imagine someone who speaks 5 or 6 languages (a polyglot). Such a person will be able to make a lot of friends on a lot of continents. Without those people from different continents having to decide to teach Esperanto in their schools.

The polyglot approach to the federated social web recognizes xmpp, all the layers of the OStatus stack, but also email, and web linking as protocols ("languages") that can at one point or another help one application understand the information that another application (on another server) is exposing.

Why propose a new approach?

For a few years now, many projects have developed distributed social networks. These are in general server-side web applications which allow users to interact socially with each other, but in a way where different user accounts need not be hosted on the same server. There are about 40 different projects like this, including StatusNet, Diaspora, Friendica, BuddyCloud, Crabgrass, Apache Wave, to name but a few. If you include the ones that do not expose a web interface, then there are even more.

Because there are so many different such application, the 'federated social web' effort was started, to make not only servers that run the same application compatible (for instance, a Diaspora server is compatible with another Diaspora server), but also servers that happen to run different software (for instance, making a Friendica server compatible with a StatusNet server). A lot of compatibility can be achieved by using existing protocols and formats, like xmpp. A notable effort to define what a server should support in order to be compatible with other application is the OStatus stack.

Despite the apparent dichotomy between the xmpp and OStatus approaches, and despite the fact that only a subset of typical social application functionality was being described by these proposals, some valuable progress was made on this topic over the last two years. But in the end, it turned out to be quite hard to agree upfront on what federation protocol each server should implement. Choosing this protocol and agreeing on a choice with all parties involved is hard, and this is not a top-down organization; each application has its own development roadmap which often understandably takes priority over the more idealistic and long-term federation efforts.

In the late spring of 2012, some people started asking how we can move on from where we are now, as it was unclear how, if, and on what timescale the different application development teams would move any closer to each other on xmpp and OStatus. One thing we came up with in this discussion was that one social web does not have to mean one federation protocol. It can be a polyglot web.

Search as the cornerstone

One thing that is needed to make the whole web feel like one big social space, instead of facebook being one closed space, twitter being another, etcetera, is to create one big Mapa Mundi: a map of the world. We may not be able to talk much to many of the people in Sulawesi, or participate in their conversations, but at least we can see they're on the map, and it makes us remember we are all part of one world, and maybe one day we will take the step to learn a new language. At least by having a map of the whole world, we're not excluding any continents a priori.

UserAddress is a search engine that can discover users as long as they are discoverable through one of the following languages:

Finding a user who has their account on another application is like smiling, in that you can do it without speaking the same language. After that, the language negotiation begins. Note the big difference here between the Polyglot approach and the Esperanto approach. With the Esperanto approach, if we don't both speak Esperanto, we will not even see each other. In the Polyglot approach, you see everyone, just maybe the communication tools are (at times, and at first) limited.

Once you have found the user you were looking for, you can see (given which languages they speak and which languages you speak), if and how you can communicate with each other.

The 'user address' query format

The software presented here is called UserAddress, and it is a search engine that produces search result rows in response to some search query. The search query can be given in two ways: free text, or user address. If you input free text, it will heuristically try to find the best matches it can come up with, based on the search index that it has cached. If you give it a user address, it will deterministically return the information it could find about that user (if any).

A user address can take one of two formats: user@host, or the URL of a document describing the user. The notation {user}@{host} is considered shorthand for https://{host}/.well-known/host-meta?resource=acct:{user}@{host}, as per webfinger-00.

URI-purists are allowed to follow the hash-URI rule and the 303s-rule when publishing their profiles, but this is no requirement. Even if you don't follow either of these rules, your profile will still show up in search results. Note however, that if you give UserAddress a URI that is not a URL, it will have no way to discover information. Also note that the URL has to resolve to a document with html, rdf, xrd, turtle or Twitter-flavoured json content, and have either http or https as its protocol (because those are the only ones we implemented for retrieval).

Tools

In order to create some structure, UserAddress considers 4 types of communication: reading, subscribing, commenting, and messaging.

Reading

Something that is almost always possible is reading another person's public information. This can be their profile, maybe with a photo, some description of their hobbies and interests, and also maybe a blog, some photo albums, some videos or podcast episodes they uploaded, etcetera.

Subscribing

The next step is subscribing to content from a person. This means that whenever they publish something new that is accessible to you, you receive a notification. This can take many forms, for instance microblogging like on twitter, but also getting a notification that there is a new comment on a photo you were tagged in. Also notifications that indicate if the person is online, busy, or offline, are useful and used by many applications to show who is online right now. Such notifications are also something you subscribe to and that pro-actively sends you a notification if you are subscribed. This model is often called the pub-sub (publication-subscription) model.

Commenting

Of course you can always comment on what you read by just linking to it. But several social networks provide a means for others to publically comment on someone's profile. This is often done on blogs (a special comments section below each blogpost), and of course the Facebook wall was a good example of a profile page that is made up primarily of what other people write on it. Sometimes a person may want to moderate what people comment on their page, and obviously the owner of the profile always retains the right to delete comments. Also, comments are not necessarily public, there are also situations where your friends are allowed to write on your wall, but also only your friends will be able to view your wall. All of this is categorized as 'commenting'.

Messaging

A valuable way of communicating on the social web is by private message. This can be a text message, a link to some other content, but even a voice call or video chat is really just a form of messaging. Whether they will be able to reply to your message is left undefined here. What is also left undefined is whether the message will fail (like with chat) or be queued up (like with email) if the person is currently offline, and whether delivery can be guaranteed. All forms of sending some sort of information directly to a recipient are categorized as messaging by UserAddress.

Other info

Apart from the tools supported by a given account, UserAddress also returns some basic info that will make it easier to recognize whether you have really found the right Joe Bloggs, and not some other person who happens to have the same name:

Project status

The current implementation of UserAddress is at gh:michielbdejong/useraddress. This is only a proof-of-concept, not production-ready. We will discuss on in the fedsocweb CG what should be done with it. If we decide we want to run this as a production service, then we need to find someone who can do that (probably one person full-time), and get funding for it.

Cross-origin services

Since we are in the business of breaking down domain barriers, this service works over a WebSocket (sockjs-compatible) that has no same-origin policy. That means you can create a widget on any web app, no matter whether it's hosted (server-side) or unhosted (client-side), and query the central index server from there. You may of course also run a local instance, but if we set up one central service, then we have the benefit of scaling the index nicely, and have better heuristic results on free-text name searches. The Websocket responds incrementally on anything you send it, so it's easy to use it for as-you-type search. You may also combine it with a local (logged-in) search on the app, so that public results get mixed with private logged-in search results.

Demo

A little demo is on github. It has no error reporting yet, and may fail without warning. Remember, this is only a proof-of-concept, not even an alpha service. But at least the examples should work.