Answers that survive a refresh or a new device

Realtime for
apps and agents.

Typed events, live presence and durable AI streams, each one line of code, over one WebSocket per channel.

Or get started with your coding agent:

Read https://pulse.anishroy.com/agents.md and add Pulse to this app.
  • Exact replay after a drop
  • Approvals on the same channel
  • 3.2 KB browser client

Presence and live cursors

Move on either screen and watch it arrive on the other.

Your screen
Typed events
Presence, 10 a second
Durable AI streams
Move your cursor here
Ada's screenanother device
Typed events
Presence, 10 a second
Durable AI streams
Or move here, as Ada
The API

Three primitives, one line each

A hook in the browser and a call on your server. One schema types events and presence, and one client carries all three.
01Events

Typed end to end

Define events once with any Standard Schema (Zod, Valibot, ArkType). Publishes are validated before they leave your server, and every event is stored before anyone receives it.

  • A client that drops gets exactly what it missed, in order, once
  • 24 hours of history by default, up to 7 days
  • An explicit gap signal, never partial history, when a client was away longer
schema.ts · server.ts · page.tsx
tsx
export const schema = defineSchema({  events: { "order.status": z.object({ orderId: z.string(), status: z.enum(STEPS) }) },  presence: z.object({ name: z.string(), cursor: Cursor.nullable() }),})
await rt.publish("orders:42", "order.status", { orderId: "42", status: "shipped" })
const status = useEvent("orders:42", "order.status")

Typed events

Published from your server, stored, then delivered to everyone.

Connecting
  1. Placed
  2. Confirmed
  3. Preparing
  4. On the way
  5. Delivered
Then refresh: it rebuilds from history.
Events on site:orders
  • No events yet.
02Presence

Who's here, cursors, typing

Join with state, update with a shallow merge, leave on disconnect; new joiners get a full snapshot. Identity comes from the signed token and the state is typed by your schema.

  • Up to 10 updates a second per connection, and the newest state always arrives
  • Smooth live cursors built in
  • Up to 1,000 members per channel
room.tsx
tsx
const { members, others, self, update } = usePresence("room:1", { name: "Ana" })update({ cursor: { x, y } }) // merged, at most 10 a second
<LiveCursors channel="room:1" />

Who's here

Joins, state changes and leaves, as they happen.

Connecting
  • Youthis tab
  • Ada
  • Kenjityping
  • Maya
site:room · 4 here
03Durable AI streams

Answers that survive a refresh

The channel holds AG-UI events (RUN_STARTED, TEXT_MESSAGE_CONTENT, TOOL_CALL_ARGS, …), each with an offset. Write token by token at any speed.

  • Late joiners and refreshed tabs replay everything, then follow live
  • Approvals and Stop travel on the same channel
  • durability: "frame" stores every frame before anyone sees it
agent.ts · chat.tsx
tsx
const s = rt.stream(`chat:${thread}`)s.start()const reply = s.message()for await (const token of llm) reply.write(token) // any speedconst { approved } = await s.requestApproval({ title: "Book TP 1351?" })reply.end()await s.finish()
// In the browserconst { messages, status, approve, reject } = useStream(`chat:${thread}`)

Durable AI stream

AG-UI events with offsets; a refresh replays, then follows live.

Connecting

A scripted agent streams its answer token by token, calls a tool, then asks you on the same channel.

Auth

One call, no round trip

Tokens are signed on your server with your secret key. They list the channels a user may join and expire; the browser fetches a new one when it needs to.

server.ts
tsx
import { Pulse } from "@anishroy/pulse/server"const rt = new Pulse({ secret: process.env.PULSE_SECRET_KEY, schema })
const token = await rt.token({ user: { id, name }, channels: ["orders:*"], publish: ["chat:*"],})
Limits

Room to grow

  • 1 MB
    per message
  • 5,000
    connections per channel
  • 1,000
    presence members per channel
  • 10 / s
    presence updates per connection
  • 7 days
    of history (24 hours by default)

The browser client is 3.2 KB gzipped.

Send your first event in minutes

Create a project, take its secret key and follow the quickstart.