Fires webhooks in the same shape Pusher sends them, so your backend can handle them with any code written for Pusher webhooks:
POST {webhook_url for this instance}
X-Pusher-Key: <app_key>
X-Pusher-Signature: HMAC-SHA256(app_secret, raw_body)
{"time_ms": 1699999999999, "events": [{"name": "channel_occupied", "channel": "..."}]}Only fires if the instance has a webhook_url configured. Delivery runs
in its own process (a Task.start/1), so a slow or dead webhook receiver
never blocks a websocket connection.
A failed delivery (network error, timeout, HTTP 5xx, 408 or 429) is
retried up to :webhook_retries times (default 3) with a doubling delay
starting at :webhook_retry_base_ms (default 1 s). Other 4xx responses
are not retried. Retried events can arrive out of order, so receivers
should be idempotent.
By default pending retries live in memory: if the node stops meanwhile
they are lost, and delivery is at-least-once only while the node stays up.
Set :webhook_queue_path (SOCKETELX_WEBHOOK_QUEUE_PATH) to a directory
and a webhook that failed its first attempt is also written to a small
file there, removed once it is delivered or given up on. After a restart
the node delivers whatever is still in the file. In Docker, mount a volume
at that path. It protects against this node restarting, not against losing
its disk.
Summary
Functions
Builds the {body, headers} for a webhook payload. Pure — no I/O, easy to test.
Starts delivery in the background (with retries). No-op if this instance has no webhook_url configured.