5

I am using cluster module to fork a new worker every time a worker process dies. My node server and client communicate over websockets (socket.io). What I see is that after a worker dies and the client connects to a new worker process, the communication occasionally falls back to xhr-polling.

So before a worker dies: websockets.

After a worker dies: xhr-polling (sometimes. But why ?. I do a see handshake errors upon reconnect when this happens)

I have configured the transport option to use 'websocket' only, but this does not seem to help.

I also tried configuring the parameters mentioned below, as suggested here. But this did not help either. I still see occasional fallback to xhr-polling after a reconnect to a new worker.

  • tryTransportsOnConnectTimeout - default value is true
  • rememberTransport - default value is true

Any idea how I can force the use websockets only ?

Thanks in advance.

Community
  • 1
  • 1
Micogle
  • 51
  • 4
  • 1
    Make sure that you use the word ``transports`` on the server and not ``transport``, such as this: ``io.set('transports', ['websocket']);`` – AmpT Apr 09 '14 at 15:39
  • Possible duplicate of [Configure TimeOut and Transports in Socket.IO 1.0](http://stackoverflow.com/questions/24685198/configure-timeout-and-transports-in-socket-io-1-0) – Paul Sweatte May 14 '17 at 00:15

0 Answers0