Socket.IO stuck on long-polling, never upgrading to WebSocket, is almost always a proxy configuration issue: nginx strips the Upgrade and Connection headers from proxy_pass by default.
Every load balancer needs sticky sessions for Socket.IO, since its handshake makes several HTTP requests before upgrading, and all of them must reach the same backend server.
Cloudflare and AWS ALB both have fixed idle timeouts that close a quiet WebSocket connection - roughly 100 seconds on Cloudflare and 60 seconds by default on an ALB - unless pings keep it active.