Nutmeg Pumpkin Macchiato

    pusher-lambda-promise

    0.1.2 • Public • Published

    pusher-lambda-promise

    A basic pusher trigger for AWS Lambda using promises.

    Related to https://github.com/pusher/pusher-http-node/issues/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.trigger(batch)
    .then((results) => {
        console.log(results);
    }).catch((error) => {
        console.error(error);
    });

    Install

    npm i pusher-lambda-promise

    DownloadsWeekly Downloads

    5

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    4.52 kB

    Total Files

    5

    Last publish

    Collaborators

    • askedio