Updated: February 202610 min read
Protocol and Session Flows
Socket event model, pairing lifecycle, transfer lifecycle, and failure behavior.
Socket Authentication Lifecycle
- Client connects to /socket.io and sends authenticate(token)
- Server validates JWT, user, and subscription state
- Client joins room with join_room(userId) after auth
- Presence and message routing are scoped to user room
Clip Relay Flow
Server validates envelope format and size limits, then emits receive_clip to other devices in room.
If no other devices are online, sender receives send_warning instead of silent drop.
Send clip event shapets
socket.emit('send_clip', {
userId: '<current-user-id>',
clip: { v: 2, payload: '<encrypted-base64>' }
});Reliability and Cleanup
- In-memory cleanup loops remove stale device/session state
- Disconnect handler cancels dependent sessions and notifies counterpart
- Pending tunnel requests timeout at 30 seconds to avoid hung resources