A simple Pusher client for use on the Espruino
var PUSHER_KEY = '...';
new Pusher(PUSHER_KEY, {}, function(pusher) {
var testChannel = pusher.subscribe('test_channel');
testChannel.bind('my_event', function(data) {
console.log('Got a message:', data);
});
});
Pusher(appKey, options, callback)
Returns: Pusher
Options (with defaults):
{
cluster: 'eu', // (optional)
encrypted: false // (optional) - NOT YET IMPLEMENTED
}
Callback:
function(pusher) { ... }
pusher.subscribe(channelName, options);
Returns: Channel
pusher.unsubscribe(channelName);
pusher.bind(EVENT, callback);
pusher.disconnect();
channel.bind(eventName, callback);
channel.trigger(eventName, data);
channel.unsubscribe();