Skip to content

Issue with strange close connections #409

@filmen

Description

@filmen

Hello,
I've a strange problem to keep a client connected for a long time.
Here is the scenario: my node app sends events to real-time dashboard where users are connected by browser via websocket and, sometimes the websocket connection doesn't remain up and the user doesn't receive the new events, expecially when a user is connected from home (ex. works in smartworking).
I've tried a lot of things:

  • set false keepalive of module and write a custom new keepalive (with setInterval and setTimeout to handle the websocket connection of every user) that drop connection after 10 seconds if the user's browser doesn't answer at keepalive message;
  • remove my custom keepalive (because doesn't fix the issue), use the keepalive of module and tune the settings to try to keep clients connected with this values:
    keepalive: true, keepaliveInterval: 20000, keepaliveGracePeriod: 10000, dropConnectionOnKeepaliveTimeout: false, disableNagleAlgorithm: true, fragmentOutgoingMessages: false
  • implemeted a round trip to check latency between my server and the user's browser (for clients that worked in smartworking sometimes are very high, on average 5/6 sec. and sometimes longer than 10 seconds - values ​​are too high in my opinion);
  • the error handler didn't show issue; only with the last modifications (use keepalive module), I see this "Error: read ETIMEDOUT";
  • firewall doens't have rules that blocks traffic on port with the app works;
  • It is possibile that a user VPN increase the latency and so the module drop the connections?

I have tested the code it with lan, wi-fi and 4G tethering and I don't have any problem but my clients, with theirs connections, have this problem also after the use the keepalive module.

What can I do to fix this situation?
I'm working in a new version of app with node 14.15.2 and last version of module (1.0.33) but meanwhile I have to fix this issue.
Thanks in advice.

Node version: 6.14.4
Module version: 1.0.23
SO: Debian 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions