This is a node.js client library for interacting with X-Stream.ly
npm xstreamly-client
The API for this library is exactly the same as for the browser based JS API
first off you need to require the library:
var XStreamly = require('xstreamly-client');
next you need to create your client:
var client = new XStreamly('app key','security token');
To subscribe to a channel:
var channel = client.subscribe('stream name',{includeMyMessages:true});
To listen for messages of a specific type:
channel.bind('message type',function(data){
//do fun stuff
});
To listen for all messages on a channel:
channel.bind_all(function(eventName,data){
//do fun stuff
});
To Send a message:
channel.trigger('message type',{name:'Brian'});
To Send a persisted message:
channel.trigger('message type',{name:'Brian'},true);
For more detailed instructions check out out documentation
install nodeunit
npm install nodeunit -g
run with nodeunit
nodeunit ./test/