WebRTC Text Chat Example ππ¬
This repository demonstrates a simple WebRTC text chat application that runs entirely in the browser. Implemented with pure JavaScript and HTML, it allows real-time text communication between two browser tabs using WebRTC's DataChannels.
Key Features β¨ Pure Browser Client: No plugins required - runs entirely in modern browsers
Direct Peer Connection: Text messages transmitted directly between browsers
Minimal Setup: Only requires Node.js for the signaling server
Zero Frameworks: Vanilla JavaScript implementation
Cross-Tab Communication: Test locally using two browser tabs
How It Works βοΈ Signaling: Clients connect via WebSocket (Node.js server) to exchange connection details
Peer Connection: Browsers establish direct WebRTC connection
Data Channel: Text messages are transmitted through a WebRTC DataChannel
Real-Time Chat: Messages appear instantly in both browser tabs
Setup Instructions π
-
Start the Signaling Server bash npm install ws node servidor.js
-
Open the Client Open index.html in two separate browser tabs
-
Start Chatting Type messages in either tab to see them appear in both!
File Structure π text βββ peer_webRTC.html # Client interface βββ servidor.js # WebSocket signaling server βββ README.md # Documentation Technical Requirements π§ Node.js v14+ (for signaling server)
Modern browser (Chrome, Firefox, Edge)
WebRTC support enabled (default in modern browsers)
Ideal For Learning π Perfect for understanding:
WebRTC peer connections
Signaling server implementation
DataChannel communication
Browser-to-browser networking
Note: For production use, additional security measures should be implemented. This demo is optimized for educational purposes and local testing.