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:
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:
{
id: string;
}Receive Presence Updates
channel.onRawEvent((event) => {
if (event.type === "presence.updated") {
console.log(event.presence?.count);
console.log(event.presence?.members);
}
});Members have the following shape:
{
id: string;
}Query Occupancy From Your Backend
const state = await edge.channels.presence("presence:document-123");The returned state contains the channel name, member count, and current members.