API Reference pusher_server v#0.1.2

Copy Markdown View Source

Modules

Embed a Pusher-protocol-compatible websocket server in your own application's supervision tree

OTP application callback — only relevant when this project is compiled and released as its own standalone deployment (the Docker image). When pusher_server is instead pulled in as a hex dependency of another app, this starts an empty supervisor and does nothing: the host app is expected to add {PusherServer, opts} to its own supervision tree explicitly (see PusherServer's moduledoc).

Implements the two signature schemes Pusher/Reverb use

The seam between "one node" and "many nodes".

Single-node, in-memory backend. No external dependencies.

Redis backend: lets several pusher_server nodes behave as one.

Keeps the shared Redis state honest when a node dies without cleaning up.

Receives other nodes' broadcasts from Redis pub/sub and delivers them to the sockets connected to this node.

The one place the websocket handler and HTTP router go through for anything that may need to reach other nodes: broadcasting, presence, and channel occupancy.

Per-instance configuration.

Plug router for the Pusher REST API

Counters and a Prometheus-format exporter for one instance.

Derives unique process/registry names from an instance name, so multiple named instances (e.g. two different app_ids on two different ports, both embedded in the same host app) never collide.

Tracks presence-channel membership for one instance. Keyed internally by socket_id so a user with multiple tabs/connections works correctly: member_added only fires for a user_id's first connection, member_removed only fires when their last connection drops.

Fires webhooks in the same shape Pusher/Reverb send them, so your Laravel app can register a webhook route the way it would for real Pusher

Implements the client-facing side of the Pusher protocol over a raw cowboy websocket (not Phoenix Channels — a different wire format).