SeuraaEdge
v1
Docs/Guides
Guides

Add live channel membership to your application.

Presence

Presence channels expose the users currently connected to a channel.

Join A Presence Channel

Issue a token for a presence:* channel:

ts
const session = edge.auth.signIn({
  channel: "presence:document-123",
  permissions: ["subscribe"],
  userId: user.id,
});

The authenticated userId becomes the presence member ID.

Member Shape

Presence returns identifiers only:

ts
{
  id: string;
}

Receive Presence Updates

ts
channel.onRawEvent((event) => {
  if (event.type === "presence.updated") {
    console.log(event.presence?.count);
    console.log(event.presence?.members);
  }
});

Members have the following shape:

ts
{
  id: string;
}

Query Occupancy From Your Backend

ts
const state = await edge.channels.presence("presence:document-123");

The returned state contains the channel name, member count, and current members.