This project is a peer-to-peer (P2P) video chat app built using WebRTC. The app allows exactly two peers to connect and chat in real-time. If a third user attempts to join, the connection will be automatically terminated to maintain the two-peer limit.
- Peer-to-Peer Video Chat: Two users can connect and communicate via live video using WebRTC.
- Auto Disconnect for Third User: If a third user tries to join the room, the app automatically disconnects the session.
- Real-time Communication: The app uses WebRTC technology to establish a direct peer-to-peer connection for smooth, low-latency communication.
- Simple and Minimal UI: A clean interface that provides an intuitive chat experience.
WebRTC (Web Real-Time Communication) is a technology that enables real-time, peer-to-peer communication directly through browsers without the need for any plugins or extra software. It supports the transmission of audio, video, and data, making it perfect for live video chat applications.
WebRTC functions as follows:
- Peer Discovery: Discovering other peers with whom the user can connect.
- Signaling: Exchanging session information and network details (candidates) between peers.
- Connection Setup: Directly connecting the peers using ICE (Interactive Connectivity Establishment), and handling NAT/firewall traversal using STUN/TURN servers.
For more information, visit the official WebRTC Documentation.
- Node.js installed on your machine.
- A WebRTC-supported browser like Chrome, Firefox, or Edge.
- Clone the repository:
git clone https://github.com/tusharmishra069/p2p-video-chat.git
- Navigate to the project directory:
cd p2p-video-chat
- Ensure that both peers use the same room code to join the chat.
- If a third user tries to join the chat room, the connection will be terminated to maintain the two-peer limit.
- WebRTC: For real-time video communication.
- HTML/CSS/JavaScript: Frontend for user interface.
Feel free to submit pull requests or issues for improvements or bug fixes.