Skip to navigation

Realtime

Receive your application's events over one WebSocket, the moment they happen, and resume without loss after a reconnect.

Your application holds one connection and one channel — its own — and receives every event it may see, for every creator it is granted. Events are the same v1 envelope as the event feed and webhooks, each with its feed cursor, so a reconnect resumes exactly where you stopped.

TopicDetail
WebSocketwss://api.evvahub.com/realtime — no query string, no Origin, no cookie
WebTransporthttps://realtime.evvahub.com (HTTP/3) — same frames and semantics
ProtocolJSON frames, version 1, negotiated in the first frame
CredentialYour access token, inside the first frame — never in the URL
Channelpartner:application:<applicationId> — the id from GET /partner/v1/app/me, not your client id

The session

1. Connect and say hello

The first frame must be hello. It carries your token and explicitly sets principal to "application".

hello
{
"protocolVersion": 1,
"type": "hello",
"frameId": "c-1",
"sentAt": "2026-12-01T10:00:00.000Z",
"channel": null,
"seq": null,
"correlationId": null,
"payload": { "credential": "evpa_live_…", "principal": "application" }
}

The token is judged exactly as the REST API judges it: live, the application and its agency active, and its scopes within what the application is allowed. The answer is welcome, which carries the connectionRef you use to resume.

2. Subscribe to your channel

Subscribe to partner:application:<applicationId>. It is the only channel an application may hold; any other channel is answered denied. No presence is ever held or shown for an application.

3. Handle events and acknowledge

Each event frame carries a seq — dense per connection on your channel — and the event envelope, including its feed cursor. Handle the event, then send a cumulative ack with that seq. An ack paces delivery and marks your progress on this connection; it never changes a message’s status.

Every event is checked again at delivery time: your current grants, the creator’s consent and your token’s scopes must allow it, and your application and its agency must still be active. An event you may not see is not delivered.

4. Resume after a reconnect

Name the channel in hello.resume.cursors with the seq and the cursor of the last event you handled. EVVA replays the recorded events after that cursor from the durable event feed — filtered by today’s grants — and continues at seq + 1.

hello with resume (payload)
{
"credential": "evpa_live_…",
"principal": "application",
"resume": {
"token": "<connectionRef from the previous welcome>",
"cursors": [
{ "channel": "partner:application:app_EXAMPLE", "seq": 41, "cursor": "<cursor of event 41>" }
]
}
}

Only a feed cursor of your application that covers the whole feed resumes the channel. If the cursor is another application’s, a webhook’s whc1. cursor or a consumer-group lease’s cursor that covers only some partitions, is past retention, or is too far behind for realtime to replay, the server answers an error frame RESUME_REJECTED naming the channel. Then read the event feed from your cursor; a 410 CURSOR_EXPIRED there means a resync through the REST API. Without a cursor, a subscription starts at “now”.

Revocation and token expiry

What happenedWhat you see
Your token expiredThe connection closes 4401 UNAUTHENTICATED at that moment. Reconnect with a fresh token.
The token was revoked, the application disabled or revoked, or the agency suspendedAn error frame SESSION_REVOKED, then close 4401 (WebTransport 3) within about a second.
A grant was narrowed or revoked, or EVVA put a creator on holdThe connection stays open — it serves your other creators. That creator’s events stop, and you receive grant.changed or access.revoked.

After a 4401, reconnect once with a fresh token. If that is refused too, stop and check the application’s status — retrying in a loop will not help.

Close codes

ReasonWebSocketWebTransportReconnect with the same token?
CLIENT_CLOSED10001Yes
SERVER_SHUTDOWN10018Yes
PROTOCOL_VIOLATION44005No — fix the client
UNAUTHENTICATED44013No — get a new token
PROTOCOL_VERSION_UNSUPPORTED44064No
HANDSHAKE_TIMEOUT44082Yes
FRAME_TOO_LARGE44136No
CONNECTION_TOO_SLOW442910Yes
CONNECTION_LIFETIME_EXCEEDED44407Yes
INTERNAL_ERROR45009Yes

error frames carry one of: INVALID_FRAME, SUBSCRIPTION_LIMIT_EXCEEDED, UNSUPPORTED_PROTOCOL_VERSION, UNAUTHENTICATED, INTERNAL_ERROR, SESSION_REVOKED, RESUME_REJECTED, ACK_INVALID, SUBSCRIPTION_REVOKED.

When realtime is at capacity

If the realtime service is full, the WebSocket upgrade is refused with HTTP 503 and Retry-After. That is not an authentication failure: wait at least Retry-After plus some random jitter, then reconnect with the same resume request.

Use an SDK

The official SDKs implement all of the above — hello, subscribe, ack after your handler, ping, reconnect with full-jitter backoff, resume by cursor, a single retry with a fresh token after 4401 — and combine realtime with the feed so a gap is always filled.

const me = await evva.app.me();
const stream = evva.eventStream({
consumerId: 'my-bot',
applicationId: me.application.id, // the application's id — never the OAuth client id
handler: async (event) => {
console.log(event.type, event.creatorId, event.eventId);
},
});
evva.shutdownOnSignals();
await stream.start();

WebTransport is available in the Go SDK. The PHP SDK uses WebSocket only; the semantics are identical.

Next steps