summaryrefslogtreecommitdiff
path: root/packages/frontend/src/stream.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/stream.ts')
-rw-r--r--packages/frontend/src/stream.ts24
1 files changed, 4 insertions, 20 deletions
diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts
index 1e2d31480c..5f0826b4e3 100644
--- a/packages/frontend/src/stream.ts
+++ b/packages/frontend/src/stream.ts
@@ -6,34 +6,18 @@
import * as Misskey from 'misskey-js';
import { markRaw } from 'vue';
import { $i } from '@/account.js';
-import { url } from '@/config.js';
+import { wsOrigin } from '@/config.js';
let stream: Misskey.Stream | null = null;
-let timeoutHeartBeat: number | null = null;
-
-export let isReloading: boolean = false;
export function useStream(): Misskey.Stream {
if (stream) return stream;
- stream = markRaw(new Misskey.Stream(url, $i ? {
+ stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
token: $i.token,
} : null));
- timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60);
-
- return stream;
-}
-
-export function reloadStream() {
- if (!stream) return useStream();
- if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
- isReloading = true;
-
- stream.close();
- stream.once('_connected_', () => isReloading = false);
- stream.stream.reconnect();
- timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60);
+ window.setTimeout(heartbeat, 1000 * 60);
return stream;
}
@@ -42,5 +26,5 @@ function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') {
stream.heartbeat();
}
- timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60);
+ window.setTimeout(heartbeat, 1000 * 60);
}