Author: Monica Wilkinson Copyright (c) 2012 VMware, Inc
Overview
Activity Streams is a simple specification used to describe social actions around the web. http://activitystrea.ms
This library provides the following Activity Stream Models on Mongoose:
- ActivityObject
- Activity
For details on the properties each see pne of the following specifications:
- http://activitystrea.ms/specs/json/1.0/
- http://opensocial-resources.googlecode.com/svn/spec/2.0/Social-Data.xml#ActivityEntry
Usage
Implicit
var streamLib = options; // Here you can extend the schemas with any pluginsstreamLibtypesUserSchema; var asmsDB = streamLibdb streamLibtypes;
Or explicit if you need a Mongoose reference in your calling code
var mongoose = ;mongoose;var streamLib = mongoose options;var asmsDB = streamLibdb streamLibtypes;
Options
-
mongoUrl --> If you want to let
activity-streams-mongoose
manage Mongoose for you, just pass the url for the MongoDB. Example format ismongodb://localhost/mongodb-asms
-
redis --> Hash including keys specifying connection properties
- host
- port
- pass
Redis is required to be able to publish activities and subscribe to Activity Streams
To create an activity object you can do
var cf = displayName: "Cloud Foundry" url: "http://www.cloudfoundry.com";cf;
To create an activity with an associated activity object you can do
var testAct = title: "Started the app" target: target_id;testAct;
To query the Activity Streams do
Asking for the latest 5 from stream "sfgiants"
asmsDBActivity;
Asking for the latest 5 from firehose
asmsDBActivity;
To publish an activity you can do
var testAct = title: "Started the app" target: target_id;testAct;
Note: This will save the activity and then publish it to the stream name
To subscribe to an Activity Stream do
var { iosockets; } asmsDBActivity;
To close the Activity Stream DB connections (MongoDB and Redis)
asmsDB;
To run tests
- Start MongoDB
- Start Redis
npm test
License
Apache License
See LICENSE file for more details