The protocol
The browser talks to the servers two ways:
- HTTP for logon, accounts, settings, uploads and push notification settings.
- One Socket.IO connection for everything live: presence, messages, games, calls, mail.
Every payload in both directions is a Zod schema in @retro/protocol. The server parses
every request before a handler sees it.
Socket calls
Section titled “Socket calls”A call goes from the browser to the server and always gets an answer:
{ ok: true, data } | { ok: false, error: { code, message } }CALLS in packages/protocol/src/api.ts is the list, one schema per call, and
CallResults gives each answer. Names are area:action, such as message:send or
call:join.
Server events
Section titled “Server events”The server sends one event channel carrying the ServerEvent union from
packages/protocol/src/messenger.ts. A message event is also echoed to the sender’s other
windows.
Rules every call follows
Section titled “Rules every call follows”session:startstarts Messenger on a connection. Until then the connection doesn’t count for presence.- Calls are rate limited per connection and per account across every server node.
- An error’s
messageis safe to show to the person.
The protocol-change checklist lists every file a new call or event touches.