Realtime

Live updates over one connection

Stream Postgres changes, broadcast messages and show who is online, all over one WebSocket.

volcano.dev/dashboard/realtime
The Volcano dashboard's realtime settings with change streams, broadcast and presence

What it does

Stop polling for changes

Subscribe once and the server pushes updates, with no WebSocket server to run.

  • Postgres changes

    Inserts and updates reach only users whose policies allow the row.

  • Broadcast

    Send cursors and typing indicators to channel subscribers.

  • Presence

    See who is online, updated as people join and leave.

What you need

  • A Volcano account

    Realtime is built in.

  • A table with a primary key

    For Postgres changes.

  • Volcano SDK

    @volcano.dev/sdk/realtime.

Try it

Three steps from zero.

  1. Turn realtime on

    Set it in volcano-config.yaml, then deploy.

    Enable

    YAML
    realtime: enabled: true broadcast_enabled: true presence_enabled: true postgres_changes_enabled: true
  2. Subscribe to a table

    The channel is named schema:table.

    Subscribe

    TypeScript
    await realtime.connect(); const cards = realtime.channel("public:cards", { type: "postgres" }); cards.onPostgresChanges("*", "public", "cards", render); await cards.subscribe();
  3. Broadcast a message

    Only subscribed clients receive it.

    Broadcast

    TypeScript
    const cursors = realtime.channel("board-42-cursors", { type: "broadcast" }); cursors.on("cursor", ({ userId, x, y }) => drawCursor(userId, x, y)); await cursors.subscribe(); cursors.send({ type: "cursor", userId: me.id, x, y });

Check it works

  • Change a row in cards. The subscribed page updates without a reload.
  • Open two tabs and move a cursor in one. The other tab shows it.
  • A tab that never subscribed receives nothing you broadcast.

Works with

Questions

Does realtime respect Postgres row-level security?

Yes, for Postgres changes. Postgres events are filtered by each user’s SELECT policies. Broadcast and presence use project-level access, so they aren’t private per user.

Are missed changes replayed after a disconnect?

No. Neither Postgres changes nor broadcast is a durable log, so re-fetch your rows after reconnecting.

How many realtime channels can one WebSocket carry?

Up to 100 channels on Hobby or 500 on Superagent, shared across Postgres, broadcast and presence.

More answers in the docs

It will blow your mind!

Pun intended. Build, deploy & scale on the Volcano platform for free.

Start building