Coder Social home page Coder Social logo

node-pusher's Introduction

A node library for Pusher API

Installation

$ npm install node-pusher

How to use

var Pusher = require('node-pusher');

var pusher = new Pusher({
  appId: 'YOUR_PUSHER_APP_ID',
  key: 'YOUR_PUSHER_APP_KEY',
  secret: 'YOUR_PUSHER_SECRET_KEY'
});

var channel = 'lobby';
var event = 'message';
var data = {
  from: 'Jaewoong',
  content: 'Hello, World'
};

// (optional) socket_id is used to prevent getting message for myself
// http://pusher.com/docs/publisher_api_guide/publisher_excluding_recipients
var socket_id = '1302.1081607';

pusher.trigger(channel, event, data, socket_id, function(err, req, res) {
  // do something (this callback is optional)
});

// auth function returns the object with the auth field which can be returned from our sever
// to authorize the socket to subscribe to a private or presence channel
// http://pusher.com/docs/auth_signatures
pusher.auth(socket_id, channel, channelData);

Credits

This library is based on the work of Christian Bäuerlein and his library pusher

License

This code is free to use under the terms of the MIT license.

node-pusher's People

Contributors

crossbreeze avatar mknysz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.