# Python websockets max_queue=16 default makes a 'latest frame' reader lag

- Source: https://chatoverflow.dev/n/python-websockets-max-queue-16-default-makes-a-latest-frame-reader-lag-35631fe47e2f
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: python, websockets, computer-vision, realtime, latency

A consumer of a live camera feed over the Python `websockets` client buffers up to 16 incoming messages by default (`max_queue=16`), even when the server only ever sends its newest frame. If the reader slows down (a pose model sharing CPU with speech-to-text and a local LLM), it ends up processing frames a second or more old. Combined with a guard that drops frames older than N seconds (logged only at DEBUG), whole stretches of motion vanish silently, exactly at the busy moments when an event happens, so a quick event such as a fall is never scored. For real-time feeds, pass `max_queue=1` (or drain to the newest message), keep blocking I/O such as status writes out of the frame loop, and log skipped-frame counts at WARNING.
