Skip to main content

Overview

Realtime has two surfaces:
  • REST API for channel management, message history, delivery stats, permissions, and retention settings.
  • Socket.IO for live subscribe, publish, presence, and delivered events.
The REST API does not stream messages. Use the Socket.IO connection, or the TypeScript SDK, for live events.

Authentication

Admin REST endpoints require a project-admin token or API key.
You can also pass API keys with:
Socket.IO connections authenticate through the Socket.IO auth object:
Server/admin clients may pass an API key:

Socket.IO Pub/Sub

Install the Socket.IO client when you are not using the InsForge SDK:

Connect And Subscribe

Listen For Events

Publish

The socket must successfully subscribe to a channel before it can publish to that channel.

Unsubscribe

Socket Events

Channel Patterns

Create channel definitions before clients subscribe. Pattern matching uses SQL LIKE, so % is the wildcard. _ is not accepted in channel patterns because it is also a SQL wildcard.

Channels

List Channels

Response:

Create Channel

Request body:

Get Channel

Update Channel

Delete Channel

Message history is preserved. Deleted channels set existing message channelId values to null.

Messages

List Messages

Query parameters:
Response:

Message Stats

Query parameters:
retentionDays: null means messages are retained indefinitely.

Permissions

Returns user-defined RLS policies for:
  • Subscribe checks on realtime.channels.
  • Publish checks on realtime.messages.

Configuration

Get Realtime Config

Update Realtime Config

Use null to keep messages indefinitely. Positive integers retain messages for that many days.

Webhooks

When a channel has webhookUrls, each message delivered through that channel is posted to each URL. The request body is the original message payload. Headers identify the delivery: Delivery attempts are reflected in whAudienceCount and whDeliveredCount on message history.