session_ended
End a session
Purpose and timing
Use for a generic end when no success/failure outcome is intended. Optional alternative terminal; do not emit after completed or failed.
Parameters and payload
No parameter is universally required for this name: the published per-game event definition is authoritative. The starter's proposal allows optional score (integer 0–1,000,000) and progress (number 0–100). It accepts no other fields. Your game's required fields or bounds can differ; inspect its current registry.
// Only valid after staff registers this event/schema for your game.
// PIExample is the provided sample helper; it waits for a real acknowledgement.
const acknowledgement = await PIExample.report('session_ended', {});
console.log(acknowledgement);{
"name": "session_ended",
"data": {}
}The JSON above shows the semantic payload; the SDK adds the UUID and V2 sequence. Keep data an object, use actual numbers (not numeric strings), and omit unregistered properties. This event is terminal. Do not send more reports in the same run after acceptance.
Platform behavior
Closes the session without the normal completed/failed result panel. A later accepted replay start opens a new session.
Validation and errors
Registration, release scope, payload types/bounds, session state, event count and strict sequence checks apply. The current serialized data limit is 8192 characters. A defined minimumIntervalMs throttles accepted occurrences. If activeSeconds is registered, it cannot exceed server elapsed time plus three seconds. Built-in games can validate mode, seed, counters and timing beyond this common contract. Do not use their custom fields for a new game without agreeing a matching schema. See error recovery.
Best practices
Report the real gameplay transition once. Observe acceptance independently from reward receipts. After rejection or timeout, stop reporting, fix the issue and reload; there is no SDK sequence-repair method. Do not calculate platform currency or entitlements from this event locally.