Nodejs + socket.io: Preventing a return to xhr polling after reconnecting to a workflow (cluster module)

I use the cluster module to develop a new worker every time a workflow dies. My node server and client communicate via websockets (socket.io). I see that after an employee dies and a client connects to a new workflow, the connection sometimes returns to the xhr poll.

So, before the employee dies: websockets.

After the worker dies: xhr poll (sometimes. But why? .. I see handshake errors when reconnecting when this happens)

I configured the transport parameter to use only "websocket", but that does not seem to help.

I also tried setting the parameters mentioned below as suggested here . But that didn't help either. I still see an accidental refusal to receive a poll after reconnecting to a new employee.

  • tryTransportsOnConnectTimeout - default value - true
  • Transport - default value - true

Any idea how I can force to use only websites?

Thanks in advance.

+3
source share

All Articles