Skip to content

miabaliga/webrtc-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebRTC Real-Time Chat & Video Calling Platform

A full-featured real-time chat application with WebRTC-based peer-to-peer video calling.

Features

Real-Time Chat

  • WebSocket-based instant messaging
  • Multiple chat rooms
  • User presence and online status
  • Typing indicators
  • Message history (last 100 messages per room)
  • System notifications for join/leave events

Video Calling

  • WebRTC peer-to-peer video calls
  • One-on-one video calls between users
  • Audio/video controls (mute, camera toggle)
  • Screen sharing capability
  • Call signaling through WebSocket
  • STUN server support for NAT traversal

User Interface

  • Modern, responsive design
  • Real-time user list
  • Incoming call notifications
  • In-call controls
  • Beautiful gradient animations

Quick Start with Docker

# Build and run
docker-compose up --build

# Or build manually
docker build -t webrtc-chat .
docker run -p 8000:8000 webrtc-chat

Usage

  1. Open http://localhost:8000 in your browser
  2. Enter your username and room name
  3. Join the room to start chatting
  4. Click "Call" next to any user to start a video call
  5. Use in-call controls to mute, toggle video, or share screen

API Endpoints

  • GET / - Web interface
  • WS /ws - WebSocket connection for real-time communication
  • GET /api/rooms - List active rooms
  • GET /api/stats - Platform statistics

WebSocket Message Types

Client -> Server

  • join - Join a room
  • chat - Send chat message
  • typing - Send typing indicator
  • start_call - Initiate video call
  • answer_call - Answer incoming call
  • ice_candidate - WebRTC ICE candidate
  • end_call - End call
  • decline_call - Decline incoming call

Server -> Client

  • history - Message history
  • users_list - Online users
  • user_joined - User joined notification
  • user_left - User left notification
  • chat - Chat message
  • typing - Typing indicator
  • incoming_call - Incoming video call
  • call_answered - Call was answered
  • ice_candidate - WebRTC ICE candidate
  • call_ended - Call ended
  • call_declined - Call was declined

Technical Details

  • Backend: FastAPI with WebSocket support
  • Frontend: Vanilla JavaScript with WebRTC API
  • Signaling: WebSocket for call coordination
  • Media: WebRTC for peer-to-peer audio/video
  • STUN Servers: Google's public STUN servers
  • Container: Docker with Python 3.12

Browser Requirements

  • Modern browser with WebRTC support (Chrome, Firefox, Safari, Edge)
  • Camera and microphone permissions
  • HTTPS or localhost required for media devices

Future Enhancements

  • TURN server for better NAT traversal
  • Group video calls
  • File sharing
  • Message reactions and emojis
  • User authentication
  • Persistent message storage (database)
  • Message search
  • Video recording
  • Chat moderation tools
  • Mobile apps (React Native)

About

Real-time WebRTC chat and video calling platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors