socketio / engine.io-client

The engine used in the Socket.IO JavaScript client, which manages the low-level transports such as HTTP long-polling, WebSocket and WebTransport.

Home Page:https://socket.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The client is losing the connection with the server but the event "close" is not triggered

dennisat opened this issue · comments

You want to:

  • report a bug
  • request a feature

Current behaviour

Suddenly the connection of the client with the server is lost. The server gets event for this but the client's "close" event is not triggered.

Steps to reproduce (if the current behaviour is a bug)

It is impossible to reproduce it locally!
This happens on production on a Heroku instance.

Expected behaviour

For any reason, if the connection is dropped we should get the "close" event or something else.

Setup

  • OS: linux
  • browser: node js app
  • engine.io version: 3.3.2

Other information (e.g. stacktraces, related issues, suggestions how to fix)

The router of Heroku consoles time to time some strange errors but are not 100% related with this bug:

2019-08-14T13:28:27.568112+00:00 heroku[router]: at=info method=GET path="/engine.io/?EIO=3&transport=websocket&sid=CX9CdiIrQYjvygsmAAIB" host=www.example.com request_id=487e4ff0-76cf-48a5-97bd-eac97bf51584 fwd="41.215.173.57" dyno=web.1 connect=0ms service=229435ms status=101 bytes=213 protocol=https

Note the service=229435ms this is really huge.

Any help is appreciated

Note the service=229435ms this is really huge.

The WebSocket connection is kept open, so that should explain the duration of the request.

I'm afraid that, without a mean to reproduce, it will be indeed hard to fix. How did you detect that the close event is not emitted by the client?

Thanks for the reply.

If the event was emitted the app would retry to get connected again.
I detected it also by consoling debug messages.

Maybe this is not a problem of your side but of the Heroku environment. In some cases, the app cannot make even XHR calls to 3rd party services, although it can send events to the log service.