Realtime
The browser receives a short-lived, single-use ticket. It never receives the long-lived Bearer credential.
- Your server calls
realtime.tickets.createwith{}or the browser's exact registered Origin. - The browser opens
socketUrlwithgscdump.v1and the ticket as its two WebSocket subprotocols. - The client applies each durable event before it advances its cursor or acknowledges the event.
- 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:
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 for frame schemas and connection rules.