Back to docs

Realtime channels

Public, private, and presence channels

Channels are realtime rooms. Choose the right channel type based on whether the data is public, protected, or needs online member visibility.

Realtime channels

Public channels

Good for open events where users do not need special permission to listen.
public-feed.global

Realtime channels

Private channels

Good for messages, private dashboards, account events, order updates, and user-specific rooms.
private-chat.room.42

Realtime channels

Presence channels

Good for online members, active viewers, live collaboration, delivery rooms, and team activity.
presence-order.884

trusted-server-route.ts

import { authorizePrivateChannel } from "@domvia/realtime-server";

app.post("/realtime/auth", async (request, response) => {
  const user = await requireSignedInUser(request);
  const channelName = request.body.channel_name;

  if (!user.canJoin(channelName)) {
    return response.status(403).json({ message: "Forbidden" });
  }

  return response.json(
    await authorizePrivateChannel({
      key: process.env.DOMVIA_REALTIME_KEY,
      secret: process.env.DOMVIA_REALTIME_SECRET,
      socketId: request.body.socket_id,
      channelName,
    }),
  );
});