28921

What's the difference between reconnectionAttempts and pingTimeout?

Question:

I know reconnectionAttempts is used for client side and pingTimeout in socket io but I quite can't understand their use. Does pingTimeout mean that socket server will disconnect (I experimented, but it didn't) from client side?

I want to know about these two because one behaviour is solving my problem but I can't understand how it is happening. I think it may be related to above two options.

<strong>Behaviour:</strong> Whenever I close the socket on client side and then emit some event to server, it doesn't work, but after connecting it again, it fires just like it was waiting for the connection.

Does it mean if connection is not available, it will <strong>queue all pending events?</strong> (I observed this thing on client side, but not on server side. Is it true for server side too?)

Answer1:

As the socket.io docs suggest,

<ul><li>

pongTimeout is the time in ms that the server will wait for a pong packet from client, before assuming the connection is dead and closing it.

</li> <li>

reconnectionAttempts is the number of times the client will try to connect to the server before giving up.

</li> </ul>

When you close the socket on client side, the server doesn't hear any pong packet to it's ping packets. By default the timeout is 60s. If you reconnect between this time, the connection will resume.

Recommend

  • Forcing a context switch from the userland on Linux?
  • How to send None with Signals across threads?
  • How to read data from socket connection - android
  • Socket io in node app on google app engine
  • Error building image: Error building rlang - not available on R 3.5.0 (Uploading shiny)
  • Error “Reflect.defineMetadata” while trying to load a transient web worker
  • Hibernate in Glassfish - Ejb3Configuration NoClassDefFoundError
  • Cursor in wrong place in contenteditable
  • Spring Integration Bridge with poller not working as expected for JMS
  • Double dispatch in Java example
  • select function not working in 3.5.4 version of d3.js
  • Spring integration inbound-gateway Fire an event when queue is empty
  • How to make Twilio api Post request with the help of AFNetworking?
  • Cloud Code function running twice
  • Why cepheus don't send int without quotes to orion?
  • Check for zero lines output from command over SSH
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • d3 v4 drag and drop with TypeScript
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • JQuery Internet Explorer and ajaxstop
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Deleting and Updating values from a cusrsor adapter
  • Optimizing database types to compact database (SQLite)
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • TFS: Get latest causes slow project reloading
  • Controls, properties, events and timers running in design time
  • Menu Color Fade on Hover with Jquery
  • Updating server-side rendering client-side
  • Modifying destination and filename of gulp-svg-sprite
  • Running a C# exe file
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Display Images one by one with next and previous functionality
  • How do I rollback to a specific git commit
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • how does django model after text[] in postgresql [duplicate]
  • Cant find why the layout is getting smaller
  • Linking SubReports Without LinkChild/LinkMaster
  • Reading document lines to the user (python)