> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Realtime

> Build websocket features in Xano the same way you build APIs — with servers, channels, and message handlers that each have their own function stack.

> [!NOTE]
>
> This is the current version of Realtime. If you're looking for the original Workspace Settings–based Realtime — channel permission rows and channel triggers — see [Realtime (Legacy)](https://docs.xano.com/realtime/realtime-in-xano). Legacy Realtime is **not deprecated**, and both systems can run side by side. See [Legacy vs Realtime](https://docs.xano.com/realtime/migrating-from-legacy-realtime.md) for a comparison.

## What is Realtime?

Realtime is anything that lets your application deliver live updates without the client asking for them — a chat window, a collaborative document, a live dashboard, in-app notifications, or multiplayer state. Instead of polling an API on a timer, the client holds one open websocket connection and receives updates as they happen.

In Xano, Realtime is a section of your workspace with the same shape as your APIs. A **message** is a named handler with typed inputs, a full function stack, and a response — the same authoring experience as an API endpoint, applied to a websocket.

## The hierarchy

The Realtime hierarchy deliberately mirrors REST, so if you can build an API in Xano you already know how this works.

| Realtime | What it is | REST equivalent |
| - | - | - |
| **Realtime Server** | What a client connects to. Has its own connection address (canonical). | API group |
| **Channel** | What a client joins, addressed by a typed path template such as `rooms/{room_id}`. | API route |
| **Message** | The invocable handler inside a channel — typed inputs, function stack, response. | API endpoint |

You can create **multiple realtime servers** in a single workspace, each with its own connection address. That lets you separate concerns — a public notifications server and an internal collaboration server, for example — without them sharing configuration or access rules.

## What you can build

Because a message is a real handler rather than a pass-through broadcast, the patterns that were impractical before become ordinary:

* **Chat** with a stored transcript, presence, and per-recipient redaction
* **Collaborative editing**, where each edit is validated before it fans out
* **Live dashboards** fed by a scheduled task publishing to a channel
* **Multiplayer state**, with typed path parameters identifying the room or match
* **Request/response over a socket** — deliver the result back to the sender only
* **Streaming an LLM or agent response** back over the same connection

## Key capabilities

> [accordion] A full function stack per message
>
> Every message declares a payload schema, so malformed payloads are rejected before any of your logic runs. From there it's an ordinary Xano function stack: middleware, database calls, external requests, a response block, and DB Preview while you build.
>
> See [Messages](https://docs.xano.com/realtime/messages.md).

> [accordion] Typed channel paths
>
> Channels are addressed by a path template — `rooms/{room_id}` — with declared parameter types (`text`, `int`, `decimal`, `bool`). Values read from a join acknowledgement or `realtime.get_session.params` can still be strings; validate or convert those transport values before using them.
>
> See [Servers & Channels](https://docs.xano.com/realtime/realtime-servers-and-channels.md).

> [accordion] Per-message delivery control
>
> `deliver_to` decides who receives each message: `channel` for everyone on it, `sender` for just the client that invoked it, `others` for everyone but the sender, or `explicit` for clients you target yourself.
>
> The delivery guarantee — `at_most_once` or `at_least_once` — is set on the channel, with optional per-recipient tracking.
>
> See [Delivery](https://docs.xano.com/realtime/messages.md#delivery) and [Delivery guarantees](https://docs.xano.com/realtime/realtime-servers-and-channels.md#delivery-guarantees).

> [accordion] Access control at every level
>
> Channels control publish policy, anonymous clients, presence, client-to-client addressing, and rate limiting. Individual messages can **require authentication** independently of the channel's join policy. Who can build and edit Realtime in the builder is governed by the **Workspace Realtime Features** RBAC permission.
>
> See [Access Control](https://docs.xano.com/realtime/access-control.md).

> [accordion] Lifecycle triggers
>
> Five triggers across two scopes let you run logic at connection and channel boundaries — including vetoing a connection or a join, and rewriting or dropping an individual delivery.
>
> See [Realtime Triggers](https://docs.xano.com/realtime/realtime-triggers.md).

> [accordion] Publishing from anywhere in Xano
>
> `realtime.publish` injects a server-authored event onto a channel from any query, function, or task — so a background task, a database trigger, or an API endpoint can drive a live update. It's the v2 counterpart to the legacy `api.realtime_event` function, and the two are not interchangeable.
>
> See [Publishing from Xano](https://docs.xano.com/realtime/publishing-from-xano.md).

## The same workflow as the rest of Xano

Realtime is not a separate subsystem with its own rules. It is authored in the same editors and follows the same governance path as everything else in your workspace:

* **Drafts and publish**, so changes don't go live on save
* **Branches and diffs**, and **version history**
* **Run & Debug** for testing a message handler without a client attached
* A **Messages** tab in [Request History](https://docs.xano.com/maintenance-monitoring-and-logging/request-history.md), with its own retention controls
* **Canvas, stack, XanoScript, and split-screen** authoring
* **CLI push and pull**, a dedicated Realtime export, and editor support from the [XanoScript Language Server extension](https://docs.xano.com/vscode-ext.md)

Your realtime logic is a portable artifact — XanoScript that pushes and pulls through the [CLI](https://docs.xano.com/xano-cli/push-pull.md) and is diffable in Git — so there's no second toolchain to learn just to put logic behind a websocket.

## Connect a client

Use the V2 server's canonical with the `/ws/` WebSocket route. Wait for a successful join acknowledgement before invoking a message handler. See [Connecting a Client](https://docs.xano.com/realtime/connecting-a-client.md) for a complete native WebSocket example, authentication, and connection troubleshooting.

## Next steps

> [card] [Servers & Channels](https://docs.xano.com/realtime/realtime-servers-and-channels.md)
>
> Create a realtime server, get its connection address, and define channels.

> [card] [Messages](https://docs.xano.com/realtime/messages.md)
>
> Write a message handler, declare its payload, and control delivery.

> [card] [Access Control](https://docs.xano.com/realtime/access-control.md)
>
> Decide who can connect, join, publish, and receive.

> [card] [Realtime Triggers](https://docs.xano.com/realtime/realtime-triggers.md)
>
> Run logic on connect, disconnect, join, leave, and deliver.


## Related topics

- [Legacy Realtime vs Realtime](https://docs.xano.com/realtime/migrating-from-legacy-realtime.md)
- [Realtime Triggers](https://docs.xano.com/realtime/realtime-triggers.md)
- [Realtime Messages](https://docs.xano.com/realtime/messages.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.