The connection to ... was interrupted while the page was loading

How can I stop this error appearing in the console whenever I refresh the page and there is an active WebSocket connection?

Firefox Console Error when WebSocket connected