How social are you?
Over the last decade, the landscape of social interaction has been significantly reshaped by the
proliferation of social media. The ease of sharing information has transformed the way news, ideas, and
opinions spread, influencing public opinion and sparking discussions on a global scale, or has it?
Wasn’t the internet supposed to do that? Why did one need social media platforms when we had the
internet? The revolution that the internet aimed to bring about was abducted by these platforms and was
walled. Raising the question - How is one social? The reply was typically on some platform. It took a perfect
storm of censorship, breach of trust by social media platforms, blockchain being adopted and data
becoming a precious commodity that brings to us the ActivityPub.
Ah, ActivityPub! Now that's a name that takes us back to the good old days of the internet, doesn't it?
Remember Atom, RSS and such protocols? It's like a CPR given to the internet, administered by the World
Wide Web Consortium (W3C). It's got a client/server API for creating, updating, and deleting content, and a
federated server-to-server API for delivering notifications and content. It's like the Swiss Army knife of
social networking protocols!
ActivityPub put in a way that is trendy and contemporary can be addressed decentralized. It's like the Wild
West of social networking. Different services can talk to each other, with no walls, and no borders. It gives
you the control. You're the boss of your data, content, and audience. You decide where it goes and who
sees it. More importantly, it gives the freedom to port yourselves. You can pack up your data and take it
with you when you move from one service to another. No more leaving your digital life behind! It's like a
universal translator for social apps. A post made on one app can be seen, shared, and read across any app
that supports ActivityPub.
ActivityPub operates in the "fediverse" (federated + universe), which is like the universe of server-to-server
social networks. It's got a client/server API for creating, updating, and deleting content and it's got a
federated server-to-server API for delivering notifications and content.
Putting you in the centre we first see what is possible with the client-to-server API of ActivityPub.
Client-to-Server API
These are called specification profiles. The client-to-server protocol is called “Social API”. The server-to-
server API is called “Federated Protocol”. Social API is used by applications that understand ActivityPub
(known as client apps) to act on behalf of a user which can be a human being or a bot. Apps that support
ActivityPub are called ActivityPub conformant clients. Mastodon is one such example. ActivityPub is built
upon ActivityStream vocabulary. Central to that is the Object. Objects are wrapped in activities which flow
in streams.
ActivityPub takes that vocabulary of Objects and specializes it to terms like Actors, Inbox and Outbox.
These objects are central to ActivityPub. These objects are represented using URI/IRI (Universal Resource
Identifier or Internationalised Resource Identifier). Let us take a look at an example –
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Person",
"id": "https://my.profile/Karthick/",
"name": "Karthick",
"preferredUsername": "karthi",
"summary": "Functional programmer",
"inbox": "https://my.profile/Karthick/inbox/",
"outbox": "https://my.profile/Karthick/outbox/",
"followers": "https://my.profile/Karthick/followers/",
"following": "https://my.profile/Karthick/following/",
"liked": "https://my.profile/Karthick/liked/"
}
If this reminds you of an email server don’t stop yourself. We still believe it is such a protocol where it has a
领英推荐
lot of similarities to a mash of social media and email and importantly exchange of information via the
internet.
Remember we are looking only at a protocol, not the client which parses this data. On the user experience
side, you will have a client application Web/Desktop/Mobile that sends these as JSON documents over to a
server that understands this schema and responds appropriately. In this article, we are neither talking about
the client nor the server. We are focused on what goes on the wire. Since, if we get this, we can
understand a host of servers and define our own experience for the client application.
Let us look at an interesting thing that one does on social media. Post an update. In ActivityPub it is too an
activity. The structure for that will look like –
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.universe/Karthick/posts/3F2504E0-4F89-11D3-9A0C-0305E82C3301",
"actor": "https://my.profile/Karthick",
"object": {
"type": "Note",
"content": "Being free once again! Staying rooted to the ground."
},
"to": ["https://www.w3.org/ns/activitystreams#Public"]
}
This is a broadcast that drops the original note of “Being free once again! Staying rooted to the ground” to
Karthick’s outbox. Which is identified by the URI https://my.profile/Karthick/outbox/. With just client-to-
server API we only reach that far. We will need the server-to-server API a.k.a Federation protocol to
complete the broadcast. Though we mentioned earlier focusing ourselves on client-to-server API let us for
a moment cross the boundary and mention server-to-server API. The message will be in the outbox of the
actor and is allowed to be read by any follower or anyone in the public who is interested in reading that. In
case this was a targeted message to another actor it would have looked like this –
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"actor": "https://my.profile/Karthick",
"object": {
"type": "Note",
"content": "Did you finish your task? Are you good to catch up for a tea?"
},
"to": ["https://my.profile/Sambavi"]
}
In the examples so far, we have seen the objects - Actor, addressing the public using a broadcast
message, and a few collections attributed to a user (i.e., inbox, outbox, followers etc.) which allows them to
be social with the world. We also peeked at a core operation of client-server API i.e. Create activity.
Beyond that in the specification, there are update, delete, follow, add, remove, like, block, and undo
activities which cover much of the social activities that one carries out.
These are some verbs that ActivityPub calls out for servers and client applications to understand. This
definition allows one to port themselves along with data to different platforms and be able to address their
friends on different social platforms. Thus, liberating the internet once again.
In the next couple of dispatches, we will look at how blockchain enables servers and clients to
communicate with each other with a host of non-functional features of security, reliability and portability.