Answer the question
In order to leave comments, you need to log in
Will ws disconnect from the server if the mobile application is closed?
i create a ws client/server connection when the mobile application is launched, the question is when will this connection break? send notification to user ?
Answer the question
In order to leave comments, you need to log in
The socket must not be disconnected while the application is active. If it is put to sleep by the system, then it will need to reconnect:
ws.onclose = function(e) {
console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);
setTimeout(function() {
connect();
}, 1000);
};
If your application is not running in the background, then yes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question