How configure reconnecting in socket.io?

前端 未结 4 1794
孤独总比滥情好
孤独总比滥情好 2021-02-02 08:40

I create socket.io connection with next code

var socket = new io.connect(\'http://localhost:8181\', {
    \'reconnect\': true,
    \'reconnection delay\': 500,
          


        
4条回答
  •  时光取名叫无心
    2021-02-02 09:19

    reconnection delay is too small 500ms increase that, on top of that 50 retries means 500 * 50 = 25000 ms which is 25 seconds. If that doesn't help set a timeout on error event on client side to recreate the socket object (After error and some delay retry to create connection).

提交回复
热议问题