A context manager that spawns a thread that checks connections periodically