Skip to content

AverageMarcus/pusher-websocket-espruino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

pusher-websocket-espruino

A simple Pusher client for use on the Espruino

⚠️ Currently a work in progress ⚠️

Example

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);
  });
});

API

Constructor

Pusher(appKey, options, callback)

Returns: Pusher

Options (with defaults):

{
  cluster: 'eu',     // (optional)
  encrypted: false   // (optional) - NOT YET IMPLEMENTED
}

Callback:

function(pusher) { ... }

Pusher

subscribe

pusher.subscribe(channelName, options);

Returns: Channel

unsubscribe

pusher.unsubscribe(channelName);

bind

pusher.bind(EVENT, callback);

disconnect

pusher.disconnect();

Channel

bind

channel.bind(eventName, callback);

trigger

channel.trigger(eventName, data);

unsubscribe

channel.unsubscribe();

About

A simple Pusher client for use on the Espruino

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published