Skip to main content

Components

Lazy server client

The pusher server SDK is imported lazily inside getPusherClient(). The dependency stays out of the bundle until the four required environment variables are present, so requests that never touch realtime remain lightweight. The client is memoised per process.
getPusherClient() returns null unless INTEGRATION_PUSHER_APP_ID, INTEGRATION_PUSHER_KEY, INTEGRATION_PUSHER_SECRET and INTEGRATION_PUSHER_CLUSTER are all set.

Best-effort publisher

publishContractEvent() is the single point that calls trigger. It swallows its own failures with structured logging: a failed publish never breaks the worker, webhook or admin action that produced it. A single event is fanned out to both the contract channel and the account channel, so account-scoped and contract-scoped listeners receive the same message.

Health accounting

Only a 5xx or a network error counts against Pusher’s health verdict. A 4xx means our request was malformed (our bug), not that Pusher is down, so it never flips the integration state. See Operations for the health probe.