Home > Back-end >  How can i setup connection timeout error in websocket?
How can i setup connection timeout error in websocket?

Time:02-11

I am trying to toast a message if I don't get a response from a WebSocket connection but I am not able to figure out how to do so

CodePudding user response:

You can display the message after some timeout:

  • Start a timer when you send the request, which will display the message when finished
  • Cancel the timer when the response comes.

You can not display a message if the response never comes, because you can not know if the response will eventually come any time later.

  • Related