Process OCPI 2.2.1 Sessions module real-time updates for an in-progress charging session
domain: evroaming.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
As the receiving party (typically the eMSP), expose the Sessions module's PATCH/PUT endpoint so the CPO can push updates for a session identified by its session_id as it progresses.
Distinguish a full PUT (complete Session object replacement, typically sent at session creation) from a PATCH (partial update carrying only changed fields, sent as the session evolves) and apply each accordingly rather than assuming every update is a full object.
Accumulate charging_periods from successive updates to build the session's running energy/time/cost breakdown, since each update may append new periods rather than resend the whole history.
Track the session's status field (e.g. ACTIVE, COMPLETED, INVALID) transitions to know when to stop expecting further PATCH updates and instead wait for the corresponding CDR via the CDRs module.
Reconcile the session's final state against its CDR once issued, since the CDR — not the last Session PATCH — is the authoritative billing record for the completed charge.
Known gotchas
A PATCH payload only contains changed fields — code that treats every incoming Sessions update as a full object will incorrectly null out fields the sender simply omitted because they hadn't changed.
Session updates and the eventual CDR are produced by different code paths on the CPO side in many implementations, so their totals can disagree in edge cases (e.g. a session marked INVALID may still generate a CDR with a different final energy value).
Ordering isn't strictly guaranteed end-to-end over HTTP — implementations should tolerate out-of-order PATCH delivery (e.g. via last-updated timestamps) rather than assuming updates always arrive in charging_periods order.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?