November 15, 2024 1 min read
Building Real-Time Workout Feedback with WebSockets
Build Log
Featured
Depth: ●○○○○
How I implemented live rep counting and form feedback in Bring The Shreds using WebSockets for sub-100ms latency.
When building Bring The Shreds, one of the core requirements was real-time feedback during workouts. Users needed to see their rep count update instantly and receive form corrections without noticeable delay.
The Challenge
HTTP polling was too slow (200-500ms latency). Server-Sent Events were one-way. We needed bidirectional, low-latency communication for pose data streaming and feedback.
The Solution
WebSocket connection with a custom protocol: client sends pose landmarks at 30fps, server responds with rep counts and form corrections. Used Socket.io for automatic reconnection handling.