Answer the question
In order to leave comments, you need to log in
Websocket on nodejs. Problem with "close" event?
I am writing a chat using websocket on nodejs. For websocket I use the module for ws . When the chat window is closed, the connection disconnection event on the server is triggered with a 10-30 second delay. How to fix it? The third day I'm struggling with a solution, I've run out of ideas.
Answer the question
In order to leave comments, you need to log in
Partially solved the problem. Such a script closes the websocket when the page is cleanly closed and the server immediately catches the event.
window.onunload = function(){
ws.close();
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question