mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Fix keep WebSockets alive.
This commit is contained in:
@@ -315,24 +315,16 @@ const WebSocketManager = (function() {
|
|||||||
function handlePageHidden() {
|
function handlePageHidden() {
|
||||||
log('Page hidden');
|
log('Page hidden');
|
||||||
state.isPageHidden = true;
|
state.isPageHidden = true;
|
||||||
stopHealthCheck();
|
|
||||||
|
|
||||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
||||||
state.isIntentionallyClosed = true;
|
|
||||||
ws.close(1000, 'Page hidden');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePageVisible() {
|
function handlePageVisible() {
|
||||||
log('Page visible');
|
log('Page visible');
|
||||||
state.isPageHidden = false;
|
state.isPageHidden = false;
|
||||||
state.isIntentionallyClosed = false;
|
|
||||||
|
|
||||||
const resumeFn = () => {
|
const resumeFn = () => {
|
||||||
if (!publicAPI.isConnected()) {
|
if (!publicAPI.isConnected()) {
|
||||||
publicAPI.connect();
|
publicAPI.connect();
|
||||||
}
|
}
|
||||||
startHealthCheck();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window.CleanupManager) {
|
if (window.CleanupManager) {
|
||||||
|
|||||||
Reference in New Issue
Block a user