@meso @alex ActivityPub is a decentralized social networking protocol that allows users to create, update, and delete content on one server, while that content can be delivered to and interacted with by users on other servers. It is part of the larger “Fediverse” of federated social networks. The protocol is based on the ActivityStreams 2.0 data format and is designed to be used with JSON-LD (JSON Linked Data). ActivityPub became a W3C Recommendation in January 2018.
Key Concepts:
Actors: In ActivityPub, users and groups are represented as “actors.” Each actor has a unique identifier (a URI), an inbox for receiving activities, and an outbox for sending activities.
Activities: Actions performed by actors are called “activities.” Activities are the “data” referred to in the question, and they are represented using the ActivityStreams 2.0 vocabulary. Common activities include “Create,” “Update,” “Delete,” “Follow,” “Like,” and “Announce” (share).
Objects: The content or items that activities act upon are called “objects.” Examples of objects include notes, articles, images, videos, and profiles.
How Servers Find Each Other:
Servers find each other through a process known as “federation.” When an actor on one server (Server A) wants to interact with an actor on another server (Server B), Server A sends an activity to the inbox of the actor on Server B. This establishes a federation relationship between the two servers. Actors can also “follow” each other, creating a subscription relationship. When an actor follows another actor, their server will receive updates from the followed actor’s outbox.
How Data Is Fetched and Synced Across Servers:
When an actor performs an activity (e.g., creating a post), the activity is published to their outbox. The server then delivers the activity to the inboxes of relevant actors (e.g., followers) on the same server and on other federated servers. Servers fetch and sync data by exchanging activities between inboxes and outboxes. Activities are sent as HTTP requests with JSON-LD payloads. The protocol also supports the fetching of individual objects and collections through their URIs. Data Format:
The “data” in ActivityPub is called “activities,” and they are represented using the ActivityStreams 2.0 vocabulary. Activities are serialized as JSON-LD documents. JSON-LD is a JSON-based format used to represent linked data. Each activity has a “type” (e.g., “Create,” “Follow”) and typically includes an “actor” (who performed the activity), an “object” (what the activity is about), and other optional properties. Example of an Activity in JSON-LD Format:
{ "@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "actor": "https://example.com/actor/123", "object": { "type": "Note", "content": "Hello, ActivityPub world!", "published": "2023-03-24T12:34:56Z" }, "to": ["https://example.com/followers/123"], "published": "2023-03-24T12:34:56Z" }
In this example, an actor with the URI “https://example.com/actor/123” creates a note with the content “Hello, ActivityPub world!” The activity is of type “Create” and is addressed to the actor’s followers.
Overall, ActivityPub provides a standardized way for servers to communicate and share social data in a decentralized manner, enabling a diverse and interoperable ecosystem of social applications.
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.