Some kind of timeout proglem with node.js / socket.io chat

We've built simple node.js socket.io chat from an example chat document. Here is our problem that we've stucked with;

  • When A person clicks to B person for chat it says "it's ready start conversation"
  • When they send message nothing happens, hitting enter only clearing message neither A nor B person sees it.
  • But if they do f5 both it says "it's ready to start conversation" again and now they can chat without any problem.
  • With this first trigger every chat can be made without f5. For example after 1-5 hours if C person clicks to D person they can start conversation without problem.
  • But if a day passed without any conversation people that starts first conversation on that day has to make f5 to make some kind of trigger. Then anyone after them starts without any problem.

The server goes some kind of timeout or screensaver mode..! People on first conversation always have to make f5. Then it works for a day.. I am not sending any code or something we need guidance what to look for. Node.js? socket.io? What can cause this silly problem? Thx

But if a day passed without any conversation people that starts first conversation on that day has to make f5 to make some kind of trigger. Then anyone after them starts without any problem.

This sounds like you're trying to keep a websocket connection open for several days without any client doing any reconnect?

If this is the case, then maybe it is a clientside problem. Perhaps the browser closes the websocket-connection after a long time. Your web app doesnt recognize the lack of connection and still shows "it's ready to start conversation". But browser doesnt send any messages to the server anymore. Check this thread: howto reestablish connection

It would help a lot, if you show us some code.

Best regards