Activity streams

Heartbeat streams

In the heartbeat api module, there are three default streams available. Each of them have a block and a page view. The pages you can visit immediately after install:

There is also a stream page available when installing friendlist_activity and choosing your User relations API:

You can register you own heartbeat access types with the hook hook_heartbeat_register_access_types.For drupal 7 this hook is called hook_heartbeat_register_streams but it works the same way. Test

Implemented

This page displays a custom heartbeat stream on the right - SiteActivity -  defined in heartbeat example module, which is located in the heartbeat project. This submodule shows the basic implementation possibilities (hooks) within heartbeat. The rest of this sites overrides and features is also available. You will find the code in the downloads section.

Technical

Every heartbeat stream is an instance of HeartbeatAccess. A HeartbeatAccess subclass is nothing more than a query builder that builds a stream of heartbeat messages. Custom modules can extend HeartbeatAccess or an already extended class to add a new stream to their site.

Underneath is the most basic example of a custom stream. So basically all you need to do is register your class and in your class you describe a sql part that will be executed when quering the heartbeat_activity table.

A great example of a stream is the one for all organic groups activity. It's located in the og_activity module  together with two others.

For each stream, heartbeat creates a block and a page display. Pages are accessible through http://example.com/heartbeat/<stream> . For instance http://heartbeat.menhireffect.be/heartbeat/publicheartbeat will show a stream of activity, visible to all (unless a message type is configured with inhibiting permissions).

Once a class exists in the system and an implementation of hook_heartbeat_register_access_types points to this class, it is available in the site administration (/admin/build/heartbeat/streams ). There you can configure each stream and delete custom streams. 

Views

Each stream has to define a function that alters the query to the heartbeat_activity table. So everything will remain the same as far as the query and it's result. However, heartbeat had to solve the tricky problem that messages can be merged and even filtered out so the maximum number of messages will not always be the same as what you would expect.  This problem i could not alter with views for the moment.Another disadvantage of heartbeat views, is that you cannot get the attachments with it. This will be possible when chosing the Heartbeat Display that comes with the implementation on Display Suite. With a build mode selected and the attachment, buttons, message, avatar etc ... draggable , this would leave us with the "count" problem only for using views vs built-in blocks and page.