Skip to content

A basic Pusher.com trigger for AWS Lambda using promises.

License

Notifications You must be signed in to change notification settings

Askedio/pusher-lambda-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pusher-lambda-promise

A basic pusher trigger for AWS Lambda using promises.

Related to pusher/pusher-http-node#67

Installation

npm install --save pusher-lambda-promise

Usage

Require the module, and initialize Pusher with settings.

const Pusher = require('pusher-lambda-promise');

const pusher = new Pusher({
    appId: process.env.PUSHER_APP_ID,
    key: process.env.PUSHER_APP_KEY,
    secret: process.env.PUSHER_APP_SECRET,
    cluster: process.env.PUSHER_APP_CLUSTER
});

Trigger single event

pusher.trigger('update', 'private-channel', {
    foo: 'foo',
    bar: 'bar'
}).then((results) => {
    console.log(results);
}).catch((error) => {
    console.error(error);
});

Trigger batch events

const batch = [
    {
        foo: 'foo',
        bar: 'bar'
    },
    {
        foo: 'foo',
        bar: 'bar'
    }
];

pusher.triggerBatch(batch)
.then((results) => {
    console.log(results);
}).catch((error) => {
    console.error(error);
});

About

A basic Pusher.com trigger for AWS Lambda using promises.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •