Real Time Events and Runtime Subscriptions
Use the platform runtime's event helpers for attendee plugins. The Events reference defaults to a bundled, source-reviewed catalog; select its deployed reference when comparing the configured platform specification. Verify the target event's actual producer, channel, payload and authorization before relying on either source. The local Dev Tools simulation and deployed WebSocket transport are different environments.
Reference scope and source selection
The bundled catalog currently describes twenty-eight message identities across thirty-eight channel/message entries. Multiple entries can represent one event broadcast to different channels. This is a selected catalog, not a complete list of supported platform events. Absence does not prove that an event is unavailable. Collection-entry lifecycle events described below have now been added after a separate producer/channel/payload review; other platform events remain outside this catalog. A class existing in the platform likewise does not make it a supported public subscription.
Use Bundled Events snapshot for the documentation revision and Deployed Events reference to compare the configured host's generated specification. Their source labels matter: generated metadata may lag actual broadcast methods, omit additional channels or contain obsolete channel mappings. Use the installation/release record and host-supplied dependency configuration to identify the installed version and bindings; if either is unavailable, obtain it from the App/platform owner before accepting the subscription. See Versioning for documentation source/version boundaries. Then compare the producer's payload/channel methods and channel authorization. If they disagree, report the event name, source label and platform version to the platform owner; avoid logging tokens or attendee payloads. Do not guess a replacement channel or treat a successful connection as acceptance.
Each event/channel pair needs its own permission check. For example, presence updates target both access-point and location channels with different callback checks; group refreshes target both dashboard and portal channels. A private transport label establishes neither project isolation nor authorization to retrieve the affected record. Use the intended principal and include a forbidden cross-project/resource case in acceptance testing. Browser receipt also does not prove a workflow, notification, admission or physical print completed.
Survey live aggregates use a separate public channel and the explicit alias survey.response.submitted; they are not private dependency events. The bundled reference includes the retained cache-order examples. A private results-display setting does not secure that channel. Read Survey & Poll System before enabling live results, and compare aggregate calculation times rather than assuming the latest event contains the newest count.
Plugin event declarations
Choose events supported for the dependency's model in Settings → Dependencies. Map the app's alias to the canonical event name and bind that dependency to a real project resource on installation. Events and data actions are separate declarations: a subscription does not grant permission to read or mutate the related record.
An explicit broadcastAs alias and a framework-default class name are different wire-name contracts. Earlier host helpers listened to the declared name literally. At develop commit 25e1564 (reviewed 2026-10-19), dependency listeners try both the short event name and its App\Events\ class-name form, with the short name first. The dependency editor normalizes saved class names to short names. Confirm the deployed host version and actual producer/formatter; this compatibility does not discover an unknown custom alias or prove the advertised event is emitted.
For the reviewed develop runtime store, the cleanup returned by store.sockets[identifier][eventAlias].listen(callback) removes that callback for both name forms on the available resource and session channels. Keep the cleanup lifecycle in the example below. The legacy host page implementation (resources/js/Portal/Pages/Show.vue) also adds both name forms but is a separate internal path, not a recommended plugin API; do not infer an identical returned-cleanup contract from the shared naming helper. Test callbacks and teardown on the installed store, including binding changes and reconnects.
A name offered by dependency metadata is not by itself proof that a matching server broadcast is produced. Model/workflow events, browser notifications and local simulation can expose different names. If an advertised alias never receives a notification, verify its actual broadcast producer and target channel for the installed version before changing code. Report stale metadata or an unverified contract to the platform owner; do not invent a raw socket subscription to make the declaration appear supported.
Use the GxP Store rather than creating a second raw Echo/Pusher connection inside a plugin. The runtime manages platform context and supported connections. A hardcoded Pusher cluster or guessed dashboard channel is not a portable plugin configuration.
Subscribe and clean up
The deployed platform exposes different sockets for different jobs:
| Socket | Use |
|---|---|
store.sockets.primary | Page whispers and the dedicated page-state helper; primary.listen is a legacy whisper alias |
store.sockets.<dependency>.<alias> | Server events mapped by that dependency’s declared event aliases |
store.sockets.project / portal | Their supported project/portal channel events and whispers; not a catch-all for every model event |
store.sockets.attendee.notification | Current attendee’s notification inbox, when an attendee identity exists |
A channel being present does not mean it emits every event in the catalog. In particular, store.listen('primary', 'CollectionEntryUpdated', callback) does not subscribe to a deployed collection lifecycle event: it follows the primary whisper path.
For a collection-bound App, declare a dependency event alias in Settings → Dependencies. The following is a dependency fragment, not a complete manifest or a substitute for your API action grants:
{
"model": "Collection",
"identifiers": ["catalog"],
"events": {
"entryUpdated": "CollectionEntryUpdated"
}
}
Bind catalog to the intended collection when installing the App. Inside a Vue component’s setup, obtain the host’s initialized GxP store and import watch and onUnmounted from Vue. The socket map is reactive: watch the nested event socket so initial registration and a later host reinitialization replace the listener safely:
const stopWatching = watch(
() => store.sockets.catalog?.entryUpdated,
(eventSocket, _previous, onCleanup) => {
if (!eventSocket) return
const stopListening = eventSocket.listen((event) => {
console.log('Collection entry changed', event.model.id)
})
onCleanup(stopListening)
},
{ immediate: true }
)
onUnmounted(stopWatching)
This logs an identifier to illustrate the event shape. In your App, reconcile the affected entry/list through its authorized API. The runtime maps the alias to the canonical event and supplies Echo’s leading dot for the literal wire event name. Select the alias as the nested property (store.sockets.catalog.entryUpdated), then call that object’s listen(callback); do not pass an event name to that nested method or add another dot.
The listener’s returned function removes this callback. The watcher registers it as cleanup, so changing/removing the event socket stops the old callback before subscribing to its replacement, and stopping the watcher on unmount disposes the current callback. The initial missing socket waits for the host to register it; a socket that never appears still needs binding/metadata troubleshooting. The nested listener is listen(callback), not listen(event, callback), and it has no separate stopListening method. A missing dependency/event object means the binding or metadata is not ready; verify it rather than silently treating an optional-chain no-op as a working subscription.
The local toolkit also supports listen(eventName, permissionIdentifier, callback) for its AsyncAPI event relay, with project as a reserved context identifier. Its dispatch distinguishes this overload from a named socket and returns an unsubscribe closure. A missing binding in the local overload produces a warning rather than acting as a production authorization gate. The deployed store reviewed here accepts the named-socket form only; a local relay test does not establish support for the extra overload in production.
AI message completion notifications
For an AiInterface dependency, declare a supported event alias for AiSessionMessageCompleted or AiSessionMessageUploadCompleted and bind the intended interface. Use the nested alias listener/cleanup pattern above; the host supplies channel and trusted session context. A completion signal and an upload-completion signal are different transitions.
Both carry a selected projection under model. The prompt can be truncated, and selected attachment URL/path/name fields can become null during size-budget processing. Top-level metadata is excluded; session metadata retains only workflow_automation and original_ai_interface_id when set. A missing session summary can be null. Read prompt_truncated and retrieve complete authorized state through the bound message API when needed; do not treat a broadcast as the full message or media-readiness guarantee.
Session metadata determines general versus session-suffixed routing, and a distinct trigger interface can receive the same event. Do not manufacture or reuse another browser's session suffix. Reconcile duplicate hints by message/session identity, verify that retrieved data belongs to the intended project/interface/session, and test forbidden principals. The selected channel callbacks do not independently establish interface/project isolation; see the per-branch limits in the Events reference. Reconnect requires current-state reconciliation rather than assuming every completion was received.
Server state notifications
For a page host exposing store.sockets.primary.listenForStateChange(callback), use that dedicated helper for server state; primary.listen remains a whisper alias. The helper merges the event's changes into triggerState before calling your callback with the full event (project_page_id, changes, updated_at), and returns a cleanup closure. Clean it up when the host/socket changes and on unmount. At platform 208d36e1b5, a form-backed page's primary socket is portal.forms.{formId} rather than portal.pages.{pageId}, because form IDs and page IDs collide on portal.pages; a form's state event is still broadcast on portal.pages.{formId} during the transition. A form's event carries only the state attendees may see: the keys in the form's ignore_keys (or, on a quiz without its own list, the live quiz defaults) are removed first.
Page and widget state events carry shallow top-level changes. New or strictly different values are included (for example, numeric 1 differs from string "1"), removed keys become null, and nested values are replaced as a whole. The inspected runtime merges the diff: removal leaves a null-valued property rather than deleting the key. An explicit null and a removed key cannot be distinguished from this payload alone. An empty diff can serialize as []. Re-read authorized current state after reconnect; a state event is not a durable replay log or proof of workflow completion. The host supplies initial triggerState during initialization. The store does not keep it live by itself: it merges server changes only while a listenForStateChange listener is registered.
At platform 208d36e1b5, an app page can read current state with GET /api/v1/projects/{team}/{project}/trigger-state/self and change it for every client with PATCH on the same path; see the Trigger State API. The same API reaches pages, forms and portal widgets bound to the app. The state of each portal widget the app binds arrives as widgetStates, read with store.getWidgetState(identifier, key, fallback). store.sockets.widgets.listenForStateChange(identifier, callback) merges that widget's changes into it and returns a cleanup closure; it does nothing for a widget not in widgetStates. A widget's state event carries every changed key, so the channel accepts the app only when it may read every key (triggerStateKeys: ["*"]); an app limited to some keys reads them with the Trigger State API.
The reference now includes ProjectPageStateChanged and ProjectPortalWidgetStateChanged with synthetic examples and channel-specific authorization limits. State values travel in the diff, so this mechanism must not be treated as secret storage or an access-control decision.
Live quiz controller channels
An app that runs a live quiz needs the full live state and the response counts, which attendee pages don't receive. They travel on portal.forms.{formId}.live (trigger_state.changed) and portal.forms.{formId}.live.analytics (analytics.updated). Only app pages bound to the quiz with the matching live quiz ability may join them. Use store.connectLiveQuizChannel(formId) rather than a dependency event alias; see Building a Live Quiz Control Panel for the abilities, payloads and helper. The bundled Events reference includes these channels and their distinct authorization requirements.
Channels, payloads and authorization
Dependency channels use the bound model ’s route key. A collection binding resolves to its slug and subscribes to portal.Collection.{collectionSlug}; a specific entry uses portal.CollectionEntry.{entryId}. Replacing the collection slug with its numeric database ID can produce a subscription that never receives the expected event. Use the installation’s resolved binding rather than constructing these channels manually. Collection slugs are unique within a project, and this channel shape contains no project segment. Projects can therefore share that collection-channel name. Checking a payload’s project ID protects UI reconciliation; it does not authorize receipt or repair a channel disclosure. An unexpected cross-project payload must be reported to the platform owner without copying its contents into logs. Do not treat subscription success as proof every notification concerns the current project: check model.project_id against the known current project and re-read through the bound project API before changing visible data.
Collection entry lifecycle events use canonical names CollectionEntryCreated, CollectionEntryUpdated and CollectionEntryDeleted. Their payload is nested under model and carries identifiers/scalars such as id, collection_id, project_id, status and timestamps. It intentionally excludes the entry’s arbitrary data blob and does not enumerate changed fields. A deleted event can arrive after the row is no longer readable; remove it from the view or handle the authorized API’s 404.
Channel authorization is surface-specific. Collection-wide channels check the collection grant/audience, while a single-entry channel can additionally enforce the attendee’s tag visibility for that row. Neither means a collection-wide event payload can safely disclose all entry fields to every subscriber. Keep the read-through-API step and test an allowed attendee, excluded attendee and a page bound to a different collection/project.
The state channels portal.pages.{pageId}, portal.widgets.{widgetId} and portal.forms.{formId} hold an app page key to its own page or form and the targets bound to it: other pages and widgets need view_trigger_state through a dependency that reaches them, and other forms need a binding in the app's dependency list or read access through the forms API. Other subscribers, such as attendee sessions, keep the project-wide check. See who may listen.
The attendee notification channel is App.Models.Attendee.{id} and authorizes the current attendee’s own ID. A page token is not an attendee identity; the runtime omits the attendee notification socket for guests and reader principals. Dashboard channels have admin guards/permissions and are not portable substitutes for an attendee App’s dependency channels.
Whispers are client-originated hints. Broadcasting one is not a database mutation, an admission decision or proof of durable server processing. Use an API command and inspect its result for those operations.
Handle state changes
Treat events as change notifications. Reconcile the affected data through the authorized API rather than assuming the event payload contains every attribute needed by your UI. Handle repeated/out-of-order events, a reconnect, a stale screen and a resource no longer visible after audience changes. A WebSocket notification is not a durable replay log: re-fetch current authorized state after reconnect rather than assuming no missed events. The runtime exposes connectionStatus; transport connection alone does not prove each private channel was authorized.
Remove listeners on unmount and when bindings change. Duplicate listeners can make one update look like multiple successful operations. Do not show a mutation as confirmed merely because the browser emitted an event.
Local and deployed verification
Use Socket Events and Dev Tools for local simulation. Then test the installed page with two clients, actual project bindings and the intended principal. Compare the bundled and deployed sources in the WebSocket Events reference, then verify the installed event/channel contract and principal-specific authorization. A generated specification or local relay pass alone is insufficient.
For server integrations, use API Integration and Webhooks when a server delivery mechanism is more appropriate. Those credentials and signature/retry rules differ from a browser's socket subscription.
Troubleshooting
For a connected socket with no model updates, check whether code subscribed to a primary whisper instead of the dependency event alias. If an installed widget has no dependency sockets, inspect whether its host supplied dependency metadata; a scalar binding alone is not enough to register an event map. For no updates, check that the dependency is bound, the event is declared/supported, the runtime connection exists and the current principal can subscribe. Inspect the browser/network error and deployed event/channel configuration. For duplicates, check listener cleanup and reconnect behavior. For visible but stale data, inspect the reconciliation query and field/resource scope.
Use Permissions and Dependencies to distinguish event subscription from page access and data authorization.