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 a join token with your name and a colour, using the app's private key. The server replies to the join with the member list (members), then keeps it current with member_joined and member_left messages.

Messages and typing indicators are client messages, named client-message and client-typing. 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 an event message, not a client_event. Clients cannot forge those.

Read the presence guide

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

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

// Members' events are named client-…; the backend's never are.
room.on("client-message", (senderId, { text }) => {
  addMessage(room.getMember(senderId), text);
});

// Third argument true: the sender gets the message back too.
form.addEventListener("submit", () => {
  room.send("client-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 set up your app and get back to you.

Write to hello@pikoman.se