Last active
August 29, 2015 14:23
-
-
Save jpatel531/55d9745368aac487d3d1 to your computer and use it in GitHub Desktop.
Pusher + Chrome Notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>Pusher Test</title> | |
<script src="//js.pusher.com/2.2/pusher.min.js"></script> | |
<script> | |
Notification.requestPermission(); | |
var pusher = new Pusher('YOUR_APP_KEY'); | |
var channel = pusher.subscribe('notifications_channel'); | |
channel.bind('new_notification', function(data) { | |
var notification = new Notification('Notification title', { | |
body: data.message | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Hello World</h1> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment