A comprehensive WebRTC implementation demonstrating peer-to-peer video communication with two different approaches: automated WebSocket signaling and manual SDP exchange.
-
Navigate to the WebSocket signaling server directory:
cd webSocket-signal-server -
Install dependencies:
npm install
-
Start the WebSocket server:
node wsServer.js
The server will run on
ws://localhost:8080 -
Open
index.htmlin two different browser tabs or windows -
Enter the same room name in both instances
-
Allow camera/microphone permissions when prompted
- Room Creation: Users join a room by entering a room name
- Peer Discovery: When two users join the same room, the server notifies both to start the connection
- SDP Exchange: Offer and answer are automatically exchanged through the WebSocket server
- ICE Candidates: ICE candidates are shared for NAT traversal
- Connection Established: Direct peer-to-peer video/audio stream begins
- Step 1: Peer 1 creates an SDP offer and copies it
- Step 2: Peer 2 pastes the offer, creates an SDP answer, and copies it
- Step 3: Peer 1 pastes the answer to establish the connection