Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSocket is closed due to suspension error on page reload

I have a button that calls a function to reload the page:

function doReload() {
 window.location='/'
}

About 1 out of 5 times Safari 11 throws this error in the console:

WebSocket connection to 'ws://localhost:8080/sockjs-node/978/yzsndro2/websocket' failed: WebSocket is closed due to suspension.

I am running a Webpack 2 dev server behind the scenes.

Doesn't seem to happen in Chrome. This is High Sierra Beta so perhaps a bug.

Suggestions or ideas?

like image 527
cyberwombat Avatar asked Aug 22 '17 20:08

cyberwombat


1 Answers

I just saw this same message in Safari 11 newest release. According to the webKit code: https://github.com/WebKit/webkit/blob/master/Source/WebCore/Modules/websockets/WebSocket.cpp#L505.

It seems to be triggered by the browser when caching the webpage, making the DOMObjects inactive. Here is the bug report that explains how that behaviour occurs: https://bugs.webkit.org/show_bug.cgi?id=143513.

like image 146
Esteban Zapata Avatar answered Oct 23 '22 13:10

Esteban Zapata