Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pusher Channels example
const Pusher = require("pusher");
const pusher = new Pusher({
appId: "APP_ID",
key: "APP_KEY",
secret: "APP_SECRET",
cluster: "APP_CLUSTER"
pusher.trigger("user-123", "notifications", {
message: "hello world"
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pusher Example</title>
<script src=""></script>
const pusher = new Pusher('APP_KEY', {
cluster: 'APP_CLUSTER'
const channel = pusher.subscribe('user-123');
channel.bind('notifications', data => {
alert('New Notification: ' + data.message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment