Channel contract
Channel names are built by helpers inpusher.client.ts — the single source of
truth shared between the publisher and the authorizer.
Private and presence channels require a signed authorization before a client
may subscribe. A presence channel also carries the list of connected
members. Totem envelopes go to the presence and/or public channel according
to the
maihuego-machine-realtime-publish-presence and
maihuego-machine-realtime-publish-public feature flags; the public channel
stays only until every client moved to presence.Event contract
The contract-domain events are enumerated inContractPusherEvent:
Account events
AccountPusherEvent lists the events published only on
private-account-{accountId} by publishAccountEvent. Every active member of
the account can subscribe, so the payloads carry flags and counts, never
personal data; the customer onboarding wizard reloads its state on each event.
onboarding.state_updated is only published while the account’s onboarding
recipient (primary user or legal representative) holds an invitation.
Channel authorizer
POST /api/v3/realtime/pusher/auth
1
Validate body
socket_id and channel_name are both required; device
(raspberry, touch, brand_experience, advertising) and surface
(enterprise, mobile) are optional and must be known (400
otherwise); alias is optional and must be an alias id (400
otherwise), so a customer joins as an alias it owns.2
Rate limit
60 signatures per minute per principal (user or API key);
429 with
Retry-After beyond that. When the limiter is unavailable the request is
let through and rate_limit_unavailable is logged.3
Enforce namespace
Only
private-contract-{uuid}, private-account-{uuid} and
presence-totem-{[a-z0-9]{1,64}} are accepted; anything else is 403
before any lookup.4
Authorize
A contract channel requires a contract session on an account that owns the
contract. An account channel requires
pusher:auth and an active
membership of the account. A presence totem channel is refused while
presence publishing is off (presence_disabled); otherwise staff join
with pusher:totem, customers with pusher:totem-session (active
machine), and a machine key holding pusher:totem-device only its own live
machine’s channel with a declared device. Only a user who sends
surface: "enterprise" (Horizon) joins as staff; any other user joins as
a customer (with pusher:totem-session or pusher:totem), so the same
person in Horizon and in the app is two members: Pusher merges
connections that share a user_id.5
Sign
Returns
{ auth }, plus channel_data for presence channels, from
authorizeChannel. Every decision is logged as pusher_auth_decision
with the channel kind, principal kind and reason, never the token or the
signature. When Pusher is not configured the endpoint returns 403.Presence identities
Horizon sends
surface: "enterprise"; the MaihueGO app sends
surface: "mobile" (older builds send none), so even an operator who opens
the app joins there as a customer.
A customer joins as the person account of its login, or, when the app sends
the optional alias (an alias of that account), as that alias; an alias of
another account is refused. A login without a person account joins as the
former customer:{userId}, which parsePresenceMemberId still accepts.
Every member sees every other member’s user_info, so it never carries names
or emails.
Example request
Example response
Presence webhooks
POST /api/v3/integration/pusher/webhook receives the Pusher presence
(member_added, member_removed), channel existence (channel_occupied,
channel_vacated) and subscription count webhooks of totem channels. The
signature (X-Pusher-Key, X-Pusher-Signature) is checked with the app key
and secret; each event is recorded once in queue_event (source pusher) and
applied by the pusher consumer group to the machine presence history and to
the current state per member.
Operators read them through:
Each expected device in the summary also carries
channelMode, the channel
its maihuego-machine-realtime-mode-* flag points it to (public for devices
without a flag), so a device that should be on the presence channel and is
not can be told from one that still listens to the public channel.
Names never travel through Pusher; the API adds them when the caller also
holds user-metadata:find-all (first and last name, or the email). The
summary lists member_names ({ member_id, name }) for the staff and
customers on the channel now, read from the recorded members and from
Pusher’s live user list, so names do not wait for the webhooks; history
events carry member_name. Without the permission the list is empty and
member_name is null, as it always is for machine devices.