Skip to content

Core concepts

Channels

Send ephemeral messages between clients without persisting them.

On this page

Not everything belongs in a document. Channels carry fire-and-forget messages, reactions, typing indicators, game ticks that are delivered to everyone currently connected and then forgotten.

ts
const room = syndra.channel("rooms/lobby")

room.on("reaction", ({ emoji, from }) => spawnEmoji(emoji, from))
room.send("reaction", { emoji: "🔥" })

Delivery guarantees

Channels favour latency over durability:

  • Messages are delivered at most once and in order per sender.
  • Clients that are offline when a message is sent never receive it.
  • Payloads are limited to 32 KB.

Typed events

Declare your events once and get end-to-end types:

ts
type LobbyEvents = {
  reaction: { emoji: string }
  typing: { isTyping: boolean }
}

const room = syndra.channel<LobbyEvents>("rooms/lobby")
room.send("typing", { isTyping: true }) // ✅
room.send("typing", { typing: true }) // ❌ type error