How sushmitadasari/webrtc-video-chat-nextjs works
This repository implements a multi-peer video meeting application: participants enter a room, grant camera/microphone access, exchange WebRTC signaling through a custom Socket.IO server, and use direct peer connections for media. The room page coordinates media, signaling, status, chat and cleanup; its components render the meeting interface. The README also documents isolated rooms, participant join/leave handling and a health endpoint. Evidence is strongest for the sampled room, hooks and server code; deployment and some UI behavior are documented but not mapped as runtime components.
Main entry points: page.tsx Room coordinator · useSocket.ts Socket client hook · useWebRTC.ts Peer connections · server.ts Custom server
Components 14
Meeting client
- Room coordinator
app/room/[roomId]/page.tsx - Remote video grid
components/VideoGrid.tsx - Call controls
components/Controls.tsx - Chat panel
components/ChatPanel.tsx
Media and signaling
- Socket client hook
hooks/useSocket.ts - Camera and mic
hooks/useUserMedia.ts - Peer connections
hooks/useWebRTC.ts
Server runtime
- Custom server
server.ts - Room membership
server.ts
Health monitoring
- Health endpoint
app/api/health/route.ts
Other components
- Participant
- Other participants
- STUN service
- Health requester
Connections 20
- Participant → Room coordinator: enters room
README.md - Room coordinator → Remote video grid: renders
app/room/[roomId]/page.tsx - Room coordinator → Call controls: renders
app/room/[roomId]/page.tsx - Room coordinator → Chat panel: renders
app/room/[roomId]/page.tsx - Room coordinator → Socket client hook: opens socket
app/room/[roomId]/page.tsx - Room coordinator → Camera and mic: gets media
app/room/[roomId]/page.tsx - Room coordinator → Peer connections: coordinates peers
app/room/[roomId]/page.tsx - Camera and mic → Participant: captures devices
hooks/useUserMedia.ts - Call controls → Room coordinator: invokes actions
app/room/[roomId]/page.tsx - Room coordinator → Remote video grid: provides remote streams
app/room/[roomId]/page.tsx - Remote video grid → Other participants: renders streams
components/VideoGrid.tsx - Chat panel → Room coordinator: submits message
app/room/[roomId]/page.tsx - Room coordinator → Socket client hook: sends chat and signaling
app/room/[roomId]/page.tsx - Peer connections → Socket client hook: sends signaling
hooks/useWebRTC.ts - Socket client hook → Custom server: connects
hooks/useSocket.ts - Custom server → Room membership: updates membership
server.ts - Custom server → Socket client hook: routes room events
server.ts - Peer connections → Other participants: exchanges media
README.md - Peer connections → STUN service: uses for ICE
hooks/useWebRTC.ts - Health requester → Health endpoint: requests status
README.md