Refactor to isolate Long-Polling + Atmosphere Protocol logic