Skip to content
Snippets Groups Projects
Commit 29856a91 authored by syuilo's avatar syuilo
Browse files

tweak of 981e6f99

parent aeb8955c
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ export function useStream(): Misskey.Stream {
function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') {
stream.send('ping');
stream.heartbeat();
}
window.setTimeout(heartbeat, 1000 * 60);
}
......@@ -186,6 +186,14 @@ export default class Stream extends EventEmitter<StreamEvents> {
this.stream.send(JSON.stringify(typeOrPayload));
}
public ping(): void {
this.stream.send('ping');
}
public heartbeat(): void {
this.stream.send('h');
}
/**
* Close this connection
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment