Socket.IO & WebRTC Architecture
Comprehensive reference of the event-driven communication layer: matchmaking queues, WebRTC peer signaling, interactive in-call gifting, and session lifecycles.
🔄 Real-Time Matchmaking Lifecycle
📡 Client & Server Event Reference
Trigger: Immediately upon establishing WebSocket connection. Binds socket ID to authenticated user ID.
Payload:Trigger: User taps "Start Matching" on mobile app radar screen or web platform.
Payload:Trigger: The matchmaking engine finds two compatible peers in queue (or connects to an active demo companion).
Payload:Trigger: PeerJS or WebRTC RTCPeerConnection emits an SDP Offer, SDP Answer, or ICE Candidate. The server relays the payload directly to the partner's socket without storing media.
Client → Server Payload:Trigger: User types an in-call text message, clicks a reaction heart, or sends an animated diamond gift during an active video session.
Client → Server (send_message):Trigger: User taps the "Next" or "Skip" button. Closes active peer stream, records session duration into call history, and immediately notifies partner.
Client → Server:socket.emit('skip_match')Server → Partner:
partner_skipped (causes client to automatically display reconnection animation and re-enter queue).
Trigger: Emitted automatically every 5 seconds to all connected sockets to update the live counter badge on web and mobile home screens.
Payload: