fix(frontend): タブがアクティブな間はstreamが切断されないように

Fix #10952
This commit is contained in:
syuilo
2023-06-06 09:04:57 +09:00
parent 8263cc0094
commit 981e6f996e
2 changed files with 12 additions and 0 deletions

View File

@@ -12,5 +12,14 @@ export function useStream(): Misskey.Stream {
token: $i.token,
} : null));
window.setTimeout(heartbeat, 1000 * 60);
return stream;
}
function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') {
stream.send('ping');
}
window.setTimeout(heartbeat, 1000 * 60);
}