Hi I had a similar issue, and I found the information from this thread to be useful and the code posted there (I’m not sure about the author’s name) does what you want :
socket.onError(() => {
if (navigator.onLine) {
console.error(`Error connecting using ${socket.transport == window.WebSocket ? 'WebSocket' : 'LongPoll'}`)
if (socket.transport == window.WebSocket) socket.transport = LongPoll;
else if (window.WebSocket) socket.transport = window.WebSocket;
}
});
There are other examples (I believe in some github issue) of how to tackle this.
Edit : the linlk to the aforementioned github issue is given by Chris McCord In the same thread






















