Skip to content

Instantly share code, notes, and snippets.

@emilianobilli
Last active April 8, 2020 21:35
Show Gist options
  • Save emilianobilli/9b2424b128ed1e9ed062afa60a27a6ce to your computer and use it in GitHub Desktop.
Save emilianobilli/9b2424b128ed1e9ed062afa60a27a6ce to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<script src="https://js.pusher.com/5.1/pusher.min.js"></script>
<script>
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('6c3d25b9b072a4c03090', {
cluster: 'us2',
forceTLS: true
});
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function(data) {
console.log(JSON.stringify(data));
});
</script>
</head>
<body>
<h1>Pusher Test</h1>
<p>
Try publishing an event to channel <code>my-channel</code>
with event name <code>my-event</code>.
</p>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment