BaatCheet is a real-time video conferencing application that allows users to create and join virtual meeting rooms for face-to-face communication. The name "BaatCheet" comes from Hindi, meaning "conversation" or "chat." The application features:
- Instant room creation and joining
- Real-time video and audio streaming
- Text chat alongside video conferences
- Screen sharing capabilities
- Low-latency peer-to-peer connections using WebRTC
- Socket.IO for signaling and real-time event handling
-
Container-based vs Serverless
- Hugging Face Spaces: Uses a persistent container-based deployment that stays running
- Vercel: Uses serverless functions that "sleep" after inactivity, requiring "cold starts"
-
WebSocket Performance
- Hugging Face Spaces: Better suited for long-lived WebSocket connections
- Vercel: Designed primarily for HTTP requests, with WebSocket connections subject to timeouts (typically 10s)
The room joining process in BaatCheet involves:
- Establishing a Socket.IO connection
- Initializing media streams
- Emitting a 'join-room' event
- Waiting for peer connections
On Vercel, if the function has gone cold, this entire sequence faces additional latency:
- 2-5 seconds for the serverless function to wake up
- Potential timeouts during WebSocket handshakes
- Delays in media stream negotiation
BaatCheet's architecture using Socket.IO for real-time communication:
// Server-side (affected by cold starts on Vercel)
const io = new Server(server, {
cors: {
origin: "*",
methods: ["GET", "POST"]
}
});
// Client-side
this.socket = io(window.location.origin);
this.socket.emit('join-room', roomId); // This call experiences delay on Vercel
- Keep Vercel functions "warm" with regular ping mechanisms (check out wakey-wakey)
- Implement connection retry logic with exponential backoff
- Add performance monitoring to identify specific bottlenecks
- Consider a hybrid approach: Vercel for static assets, HF Spaces for WebSocket server
For optimal real-time performance in BaatCheet, Hugging Face Spaces remains the better deployment option due to its container-based architecture that better supports persistent WebSocket connections required for video chat applications.