A secure, private, and direct P2P video and chat application.
Whisper is a real-time communication platform designed to demonstrate the power of WebRTC and Peer-to-Peer (P2P) technologies. It allows users to chat, share files, and make audio/video calls directly between devices without the data passing through a central server (except for signaling).
- Real-time Chat: Instant messaging with delivery status.
- P2P Video & Audio Calls: High-quality calls connecting directly between users.
- File Sharing: Send files of any size directly peer-to-peer.
- End-to-End Encryption: All media and data are encrypted by WebRTC standards.
- Latency Ping: Verify your direct connection speed with the built-in P2P Ping tool.
- Connection Stats: Real-time monitoring of connection type (P2P/Relay) and bitrate.
- Mobile Responsive: Professional UI that adapts to phones, tablets, and desktops.
- Dockerized: Easy deployment with Docker Compose.
- Language: Go (Golang) 1.23
- Library:
gorilla/websocket - Role: The server acts only as a matchmaker. It helps two peers find each other by exchanging "Signaling" data (SDP and ICE candidates). Once connected, the server is not involved in the media or data transfer.
- Security: Supports TLS/SSL (HTTPS/WSS) for secure signaling.
- Core: Vanilla JavaScript (ES6+), HTML5, CSS3.
- Protocol: WebRTC (RTCPeerConnection, RTCDataChannel).
- Styling: Custom CSS with a mobile-first, responsive design.
- No Frameworks: Built without React/Vue/Angular to demonstrate the raw power of browser APIs.
- Containerization: Docker & Docker Compose (Alpine Linux base).
- Certificates: OpenSSL for self-signed certificates (required for WebRTC media access).
Before two devices can talk directly, they need to know how to reach each other. This is done via the Signaling Server:
- User A joins a room.
- User B joins the same room.
- The server notifies User A that User B has joined.
When User A calls User B:
- Offer: User A creates an "Offer" (SDP) describing their media capabilities (codecs, encryption) and sends it to the server.
- Relay: The server forwards this Offer to User B.
- Answer: User B accepts the offer, creates an "Answer" (SDP), and sends it back via the server.
- ICE Candidates: Both devices discover their network paths (IP addresses, ports) and exchange them as "ICE Candidates".
Once the handshake is complete:
- Video/Audio: Flows directly from Device A <-> Device B via UDP.
- Chat/Files: Flows through an
RTCDataChannel(SCTP protocol) directly between peers. - Privacy: The server cannot see or record the video, audio, or file contents.
To prove the connection is truly Peer-to-Peer:
- Start a chat or call.
- Click the ⚡ (Lightning) button in the chat header.
- This sends a timestamped message through the direct data channel.
- The round-trip time (Latency) will be displayed. In a local network, this is often < 10ms, which is impossible if routing through a remote server.
- Docker & Docker Compose (v2)
- A modern web browser (Chrome, Firefox, Safari)
-
Clone the repository:
git clone https://github.com/yourusername/whisper.git cd whisper -
Run with Docker Compose:
docker compose up -d --build
-
Access the App:
- Open
https://YOUR_LOCAL_IP:8080(e.g.,https://192.168.1.50:8080) on your computer and mobile phone. - Important: Since we use self-signed certificates, you must accept the security warning in your browser ("Advanced" -> "Proceed to...").
- Open
WebRTC requires a "Secure Context" (HTTPS or localhost) to access the microphone and camera. We generate self-signed certificates automatically in the Docker build to enable this on your local network.
The application features a responsive design:
- Desktop: Sidebar with user list is always visible.
- Mobile: Sidebar slides away when chatting. Swipe or use the "Back" button to return to the user list.
- Controls: Large, touch-friendly buttons for calls and media.
MIT License - Feel free to use and modify for educational purposes.