Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with strange close connections #409

Open
filmen opened this issue Jan 11, 2021 · 6 comments
Open

Issue with strange close connections #409

filmen opened this issue Jan 11, 2021 · 6 comments

Comments

@filmen
Copy link

filmen commented Jan 11, 2021

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

@Sasha2018RL
Copy link

I have same issue

@Sasha2018RL
Copy link

Temporary fixed for my case by adding ping method, and if it fails - I using force reconnect

@filmen
Copy link
Author

filmen commented Jan 18, 2021

Temporary fixed for my case by adding ping method, and if it fails - I using force reconnect

Hi! Do you use ping/pong function of connection instance (WebSocketConnection) or you have implemented a custom ping/pong?

@madeindra
Copy link

madeindra commented Apr 1, 2021

@filmen @Sasha2018RL I stumble upon the same issue, did you solve this?
For now, I keep restarting my app every week

@Sasha2018RL
Copy link

@filmen @Sasha2018RL I stumble upon the same issue, did you solve this?
For now, I keep restarting my app every week

I moved to socket io

@madeindra
Copy link

madeindra commented Apr 3, 2021

@Sasha2018RL Can you share your old ping method for temporary fix please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants