I\'m trying to implement a WebSocket with a fallback to polling. If the WebSocket connection succeeds, readyState becomes 1, but if it fails, readyState>
readyState
readyState>
Your while loop is probably locking up your thread. Try using:
setTimeout(function(){ if(socket.readyState === 0) { //do nothing } else if (socket.readyState !=1) { //fallback setInterval(poll, interval); } }, 50);