Skip to content

Latest commit

 

History

History
124 lines (79 loc) · 3.7 KB

File metadata and controls

124 lines (79 loc) · 3.7 KB
title Realtime
description Realtime protocol schemas

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

Transport Protocol Enum

Defines the communication protocol for realtime data synchronization

**Source:** `packages/spec/src/api/realtime.zod.ts`

TypeScript Usage

import { RealtimeConfig, RealtimeEvent, RealtimeEventType, RealtimePresence, Subscription, SubscriptionEvent, TransportProtocol } from '@objectstack/spec/api';
import type { RealtimeConfig, RealtimeEvent, RealtimeEventType, RealtimePresence, Subscription, SubscriptionEvent, TransportProtocol } from '@objectstack/spec/api';

// Validate data
const result = RealtimeConfig.parse(data);

RealtimeConfig

Properties

Property Type Required Description
enabled boolean Enable realtime synchronization
transport Enum<'websocket' | 'sse' | 'polling'> Transport protocol
subscriptions { id: string; events: { type: Enum<'record.created' | 'record.updated' | 'record.deleted' | 'field.changed'>; object?: string; filters?: any }[]; transport: Enum<'websocket' | 'sse' | 'polling'>; channel?: string }[] optional Default subscriptions

RealtimeEvent

Properties

Property Type Required Description
id string Unique event identifier
type string Event type (e.g., record.created, record.updated)
object string optional Object name the event relates to
action Enum<'created' | 'updated' | 'deleted'> optional Action performed
payload Record<string, any> Event payload data
timestamp string ISO 8601 datetime when event occurred
userId string optional User who triggered the event
sessionId string optional Session identifier

RealtimeEventType

Realtime event type (not yet enforced — the runtime emits data.record.* event names instead, and field.changed is never emitted; see #3197)

Allowed Values

  • record.created
  • record.updated
  • record.deleted
  • field.changed

RealtimePresence

Properties

Property Type Required Description
userId string User identifier
status Enum<'online' | 'away' | 'busy' | 'offline'> Current presence status
lastSeen string ISO 8601 datetime of last activity
metadata Record<string, any> optional Custom presence data (e.g., current page, custom status)

Subscription

Properties

Property Type Required Description
id string Unique subscription identifier
events { type: Enum<'record.created' | 'record.updated' | 'record.deleted' | 'field.changed'>; object?: string; filters?: any }[] Array of events to subscribe to
transport Enum<'websocket' | 'sse' | 'polling'> Transport protocol to use
channel string optional Optional channel name for grouping subscriptions

SubscriptionEvent

Properties

Property Type Required Description
type Enum<'record.created' | 'record.updated' | 'record.deleted' | 'field.changed'> Type of event to subscribe to
object string optional Object name to subscribe to
filters any optional Filter conditions

TransportProtocol

Allowed Values

  • websocket
  • sse
  • polling