In mac, reconnect loop with 'Invalid state error'

543 views Asked by At

When the network goes down and comes, the primus reconnect happens. But it is getting triggered in loop. Also it shows the "INVALID_STATE_ERR" and also, 'websocket is closed before the connection is established'. Primus with sockJS I am using for transports.

Note: On reconnect, I am removing(ending) the existing socket connection and want to make new socket connection with certain condition for my client session validation.

Works fine in windows machine. Only in mac this reconnect in loop is happening. Can some one suggest what the issue is?

2

There are 2 answers

0
3rdEden On

If this issue is still happening in the latest version of Primus, please open an issue on our Github repository with steps to reproduce as it's most likely a bug in module. Also instead of removing sockets on reconnect I would suggest disabling the reconnect and just manually re-open the connection on the end event.

0
Kakar On

Just encountered the same problem. My issue was that I was making two WebSocket connection. Hope this will help somebody like me.