API Reference socketelx v#0.2.0

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 socketelx 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 {Socketelx, opts} to its own supervision tree explicitly (see Socketelx's moduledoc).

Implements the two signature schemes the Pusher protocol uses

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

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

Redis backend: lets several socketelx 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 sends them, so your backend can handle them with any code written for Pusher webhooks

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