Chat with presence

This room is private to its link. Join, then open the invite link in another window or send it to someone to chat with them.

Join the room

Leave it empty and the server picks one for you.

Open a second window

How it works

Joining calls this site's backend, which signs your name and a colour with the app secret. The server replies to the join with the member list (opcode 16), then keeps it current with join (2) and leave (4) frames.

Messages and typing indicators are client messages. A message is sent to everyone including yourself, so the echo doubles as a delivery receipt and the round trip can be timed. Typing goes to everyone else only.

The greeting is different: the backend publishes it with an HTTP POST, so it arrives as a server message (opcode 1). Clients cannot forge those.

Read the presence guide

chat.ts
const room = pikoman.listenPresence(`presence-chat-${roomId}`, authenticator);

room.members((members) => renderMembers(members));

room.on("message", (senderId, { text }) => {
  addMessage(room.getMember(senderId), text);
});

// Third argument true: the sender gets the message back too.
form.addEventListener("submit", () => {
  room.send("message", { text: input.value }, true);
});

// Server messages have no sender id.
room.on("bot", ({ text }) => addBotMessage(text));

We are rebuilding the dashboard

Self-service sign-up is closed while we do. Until the new dashboard is ready we set up apps by hand: write to us with a line about what you are building, and we will send you an app id and a secret.

Write to hello@pikoman.se