Realtime events
The app keeps a Socket.IO connection to /socket.io, authenticated with the session cookie. On connect, the socket joins a room for its user and one for its device, presence is refreshed, and any calls still ringing for the user are re-sent.
Event names are deliberately short to keep frames small. They're defined in @yacs/dto/events:
import { MessageEvent, EnvelopeEvent } from "@yacs/dto/events";
Most client → server events use Socket.IO acknowledgements to return a result.
Conversations
| Event | Code | Direction | Description |
|---|
ConversationEvent.CREATE | vc | server → client | A conversation was created with you (e.g. someone accepted your invite). |
ConversationEvent.UPDATE | vu | server → client | Conversation changed (name, members…). |
ConversationEvent.DELETE | vd | server → client | Conversation removed. |
Messages
| Event | Code | Direction | Description |
|---|
MessageEvent.CREATE | mc | both | New message. |
MessageEvent.UPDATE | mu | both | Message edited or status changed. |
MessageEvent.DELETE | md | both | Message deleted. |
MessageEvent.DELETE_ALL | mD | server → client | All messages in a conversation deleted. |
MessageEvent.TYPING | mt | both | Typing indicator. |
MessageEvent.READ | mr | both | Read receipt. |
Users
| Event | Code | Direction | Description |
|---|
UserEvent.UPDATE | uu | server → client | A contact's name or presence (isOnline, lastSeen) changed. |
UserEvent.STATUS | us | client → server | Reports whether the app is visible ({ active }), which drives presence. |
Calls
| Event | Code | Direction | Description |
|---|
CallEvent.MAKE | cm | server → client | Incoming call. |
CallEvent.ANSWER | ca | both | Client answers a ringing call; the server tells the caller and the callee's other devices it was answered. |
CallEvent.DISCONNECT | cd | both | Hang up (client reports duration); the server notifies the other side when a call ends. |
Envelopes
Envelopes carry direct-conversation traffic (see Conversations). Payloads are yacs.v1 protobuf messages.
| Event | Code | Direction | Description |
|---|
EnvelopeEvent.SEND | es | client → server | Relay an EnvelopeSend (with devices already reached peer to peer). |
EnvelopeEvent.RECEIVE | eR | server → client | Relayed Envelope. |
EnvelopeEvent.SYNC | eS | client → server | Fetch queued envelopes (EnvelopeBatch). |
EnvelopeEvent.ACK | ea | client → server | EnvelopeAck — stored envelope IDs to drop from the queue. |
Peers & transfers
| Event | Code | Direction | Description |
|---|
PeerEvent.REGISTER | pr | client → server | Register this device's PeerJS peer ID. |
PeerEvent.LIST | pl | client → server | List peer IDs of a conversation's other devices. |
PeerEvent.RESOLVE | pR | client → server | Resolve the user/device behind an incoming peer connection from its ticket. |
PeerEvent.TRANSFER_OFFER | po | client → server | Sender offers a file for transfer from this device. |
PeerEvent.TRANSFER_TICKET | pt | client → server | Recipient gets a signed ticket and the sender's peer ID. |
PeerEvent.TRANSFER_VERIFY | pv | client → server | Sender verifies a recipient's ticket before sending. |
PeerEvent.TRANSFER_WITHDRAW | pw | client → server | Sender withdraws an offer. |
Peer tickets are signed by the server, so a device only accepts peer connections and file requests from users it is actually in a conversation with.