---
title: "Realtime"
description: "Receive hosted change notifications with tickets, replay, and application resync."
canonical_url: "https://gscdump.com/gscdump-sdk/api/realtime"
last_updated: "2026-10-03T07:15:32.050Z"
---

# Realtime

The browser receives a short-lived, single-use ticket. It never receives the
long-lived Bearer credential.

1. Your server calls `realtime.tickets.create` with `{}` or the browser's exact
registered Origin.
2. The browser opens `socketUrl` with `gscdump.v1` and the ticket as its two WebSocket subprotocols.
3. The client applies each durable event before it advances its cursor or
acknowledges the event.
4. If replay is unsafe, the client runs a full authoritative resync before it
reports fresh state.

`createGscdumpRealtimeV1Client` owns ticket rotation, replay, cumulative ACKs,
heartbeat checks, reconnect backoff, and the 15-minute connection lifetime.
You provide the application-specific effects:

::pre{tabindex="0"}
```ts
import {
  createGscdumpRealtimeV1Client,
  createGscdumpV1Client,
} from '@gscdump/sdk/v1'

const http = createGscdumpV1Client({
  credential: () => process.env.GSCDUMP_API_KEY!,
})

const realtime = createGscdumpRealtimeV1Client({
  ticketProvider: () => http.createRealtimeTicket({ body: {} }),
  // Implement these hooks in your application.
  applyEvent: async (event) => {
    await invalidateResources(event.changes)
  },
  resync: async () => {
    await reloadAuthoritativeState()
  },
})

await realtime.start()
```
::

This example runs on the server.
For browsers, make `ticketProvider` call your same-origin server ticket endpoint.
That endpoint must request a ticket with the browser's exact registered Origin.
Generate the [AsyncAPI specification](/gscdump-sdk/api/hosted-http#api-specifications) for frame schemas and connection rules.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
