PusherServer.HttpRouter (pusher_server v0.1.2)

Copy Markdown View Source

Plug router for the Pusher REST API:

  • POST /apps/{app_id}/events: trigger an event
  • POST /apps/{app_id}/batch_events: trigger up to 10 events at once
  • GET /apps/{app_id}/channels: list occupied channels (filter_by_prefix, and info=user_count for presence channels)
  • GET /apps/{app_id}/channels/{channel}: one channel's info
  • GET /: health check; GET /metrics: Prometheus metrics (opt-in)

Signature verification happens on the raw body/query, before any JSON parsing, since the signature covers the exact bytes sent.

The instance name comes in via the plug opts configured in the cowboy dispatch table ({Plug.Cowboy.Handler, {PusherServer.HttpRouter, name: name}}) and is stashed in conn.private by overriding call/2 — the standard Plug technique for parameterizing a Plug.Router.

Summary

Functions

Callback implementation for Plug.init/1.

Functions

init(opts)

Callback implementation for Plug.init/1.