Implementing Activity Streams

An activity comprises a number of elements such as the person creating the activity, the object being acted upon, and the target of the activity. For instance, consider the following sentence:

Mary added to a new photo into her collection.

If we break this sentence down by Activity Stream standards, we can describe the following items:

Mary

The actor of the activity. We may create an actor object for Mary that links back to her profile or provides additional information about her.

photo

The object of the activity. The photo may be a structure that contains media information such as a URI, width, and height.

collection

The target of the activity. This target may be composed of many different objects such as photos and videos. The collection can be expanded with additional information or objects.

The Activity Streams specification goes beyond defining just a few simple constructs, attempting to build out a comprehensive model for developers and companies to structure their updates and activities according to the data they contain:

{ "items" : [ { "verb": "post", "published": "2011-02-18T16:26:43Z", "generator": { "url": "http://example.com/activities-app" }, "provider": { "url": "http://providersite.com/activity-stream" }, "title": "Mary added a new photo to her album.", "actor": { "url": "http://providersite.com/mary", "objectType": "person", "id": "tag:provider.com,20110218,162643:mary", "image": { "url": "http://providersite.com/mary/image", "width": 125, "height": ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.