Skip to content

Use case

Notifications

A per-user private channel turns delivery into one publish. Whatever the user has open receives it, and your code never tracks which.

private-user-1e9
  • private channels
  • events
  • webhooks

How it works

  1. 01Subscribe per userYour auth endpoint confirms the socket belongs to that user and nobody else.
  2. 02Publish onceOne trigger on that channel. Reaching every open session is our job.
  3. 03Know if nobody is listeningOccupancy webhooks tell you when to fall back to email instead.

Worth knowing

Delivery reaches sessions open right now. Anything that must survive a closed tab needs storing — the channel is delivery, not the record.

In code

notify.js
js
// One trigger reaches every device this user has connected.await pusher.trigger(`private-user-${user.id}`, 'notification', {  id: notification.id,  kind: 'mention',  title: 'You were mentioned in #incidents',  url: `/threads/${thread.id}`,})

Written with the official Pusher libraries, unmodified — there is no PushCaster package to install. Full documentation

Other things people build

All use cases
presence-room-42

Realtime chat

Rooms, membership and typing indicators on presence channels.

private-metrics

Live dashboards

Push metrics as they change instead of polling for them.

Create an application and build it.

Support