“websocket was interrupted while page is loading” on Firefox for Socket.io

前端 未结 6 1842
不知归路
不知归路 2020-12-07 13:19
Error: The connection to  was interrupted while the page was loading.
Source File: localhost/socket.io/node_modules/socket.io-client/dist/socket.io.         


        
6条回答
  •  星月不相逢
    2020-12-07 13:51

    It happens because, you are not closing your open websocket.

    This code would remove this error:

    $(window).on('beforeunload', function(){
        socket.close();
    });
    

提交回复
热议问题