ActivityPub: A Box is not a Timeline

A key concept in the ActivityPub specification is the inbox and outbox. These are ordered collections of activities where the inbox contains activities received from other actors (typically on other servers) and the outbox contains activities produced by the actor owning the outbox.

The inbox is part of the Server-to-Server (S2S) protocol that implements federation between servers. The outbox is part of the Client-to-Server (C2S) protocol and receives activities from an external client associated with the actor owning the outbox.

It's a common misperception that these "boxes" are the same as a timeline in a server like Mastodon. Although they are related, they are quite different.

A timeline contains a time-ordered (reverse chronological) collection of objects. In the case of Mastodon, these are Mastodon-specific Status objects that are communicated as ActivityPub Notes. However, an inbox or outbox contains Activities.

To create a timeline from a box, you must process the series of Activities in the box to determine what objects are in the timeline. For example, a specific object may have been created with a Create activity, updated multiple times with an Update activity, and then deleted with a Delete activity.

A Simple Example

For example, the following inbox events:

  • Create note-1
  • Create note-2
  • Update note-1
  • Create note-3
  • Delete note-2

Would be represented in reverse-chronological order in the inbox:

  • Delete note-2
  • Create note-3
  • Update note-1
  • Create note-2
  • Create note-1

Would result in a timeline with the following objects:

  • note-3
  • note-1 (updated)

Standardizing Timelines

The C2S protocol is not widely implemented, but it can be interesting to think about how timelines would be supported with ActivityPub C2S. One possibility is that the actor's streams property could contain a list of timelines URIs that correspond to Mastodon's home, local and federated timelines. It could also have timelines for account lists and hashtags. As activities are processed by the ActivityPub server, these timelines would be maintained automatically so they don't need to be computed by processing the result of an inbox query. This has the potential to allow a standard C2S client to provide a user experience similar to the popular Mastodon clients.

Leave a Comment

Mastodon