diff --git a/CHANGELOG.md b/CHANGELOG.md index 4296288788..cc13749caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ ## 13.13.1 (unreleased) +### Client +- Fix: タブがアクティブな間はstreamが切断されないように + ### Server - Fix: api/metaで`TypeError: JSON5.parse is not a function`エラーが発生する問題を修正 diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts index 9cae58a26a..a807d1d306 100644 --- a/packages/frontend/src/stream.ts +++ b/packages/frontend/src/stream.ts @@ -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); +}