interface RealtimeArm

The real-time arm: one option grouping the three plugins that together make a connection-oriented application work, each added only when its sub-arm is present.

Grouped rather than flattened into three unrelated-looking top-level options so the real-time story stays discoverable as a unit. realtime: {} adds nothing and is not an error.

Examples

Rooms fanned out across replicas

const app = createRestApp({
  realtime: {
    websocket: { routes: [] },
    backplane: { transport: 'redis', url: 'redis://localhost:6379' },
  },
});

Properties

optional
websocket: WebSocketPluginOptions

Options for WebSocketPlugin. Present → the plugin is registered.

On Node and Bun a WebSocket upgrade needs a real listening server, so the plugin registers with available: false under app.inject(); the same application code is correct on Deno and Cloudflare Workers.

optional
sse: SsePluginOptions

Options for SsePlugin. Present → the plugin is registered.

optional
backplane: RealtimeBackplanePluginOptions

Options for RealtimeBackplanePlugin, which fans WebSocket rooms and SSE channels out across replicas. Present → the plugin is registered at PLUGIN_PRIORITY.HIGH, so it precedes both consumers.

Absent → the WebSocket and SSE plugins emit their scaling notice, because their broadcast membership stays in-process.

{} selects the 'memory' transport, whose discriminant is optional. { transport: 'messaging' } requires a MessagingPlugin in the same application — the microservice and full-stack tiers supply one; on the REST tier the backplane's own register() throws naming it.

See

Usage

import { type RealtimeArm } from "starters/rest-starter/src/index.ts";