Skip to content

Instantly share code, notes, and snippets.

@leggetter
Created June 13, 2015 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leggetter/8880b867c9462fb3bf15 to your computer and use it in GitHub Desktop.
Save leggetter/8880b867c9462fb3bf15 to your computer and use it in GitHub Desktop.
How easy it is to integrate Pusher
<script src="//js.pusher.com/2.2/pusher.min.js"></script>
<script>
var pusher = new Pusher('YOUR_APP_KEY');
var channel = pusher.subscribe('test_channel');
channel.bind('my_event', function(data) {
// do something awesome with data
// e.g. showNotification(data.msg)
});
</script>
require 'pusher'
Pusher.app_id = 'YOUR_APP_ID'
Pusher.key = 'YOUR_APP_KEY'
Pusher.secret = 'YOUR_APP_SECRET'
Pusher.trigger('test_channel', 'my_event', {msg: 'hello world'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment