Pusher with Node.js

Pusher with Node.js Partner JavaScript


This git repository provides a quickstart demonstrating how to use Pusher on OpenShift in a Node.js application.

Once you've created the quickstart, you'll need to create a Pusher account and add your authorization information to your Git repository. Making code changes will require you to set a public SSH key, and then to clone your new application Git repository onto your local machine. See the Getting Started page for more steps in this flow.

Step 1. Configure Pusher

  1. Sign up via http://pusher.com/signup
  2. Take a note of your application credentials: app_id, app_key and app_secret
  3. Replace the values in config.json with the credentials.

Step 2. Deploy your app

    git add .
    git commit -m "my first commit"
    git push

Step 3. View your app!

Visit https://myapp-<yournamespace>.rhcloud.com and click on the Trigger Hello World button. This will result in a message being triggered and being broadcast to everybody viewing the page.

(Optional) Step 4. Additional Customizations

You can update the PHP in server.js to change how the message is triggered.

You can also update the JavaScript in views/index.ejs to change the channel that is subscribed to, the event which is bound to and how the event is handled.

More Information

Pusher documentation: http://pusher.com/docs

Debugging your application: http://pusher.com/docs/debugging

Pusher client and server libraries: http://pusher.com/docs/libraries

Pusher Support on StackOverflow: http://stackoverflow.com/questions/tagged/pusher