mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 05:23:08 +02:00
tweak of 981e6f996
This commit is contained in:
parent
aeb8955ca2
commit
29856a9129
2 changed files with 9 additions and 1 deletions
|
@ -19,7 +19,7 @@ export function useStream(): Misskey.Stream {
|
||||||
|
|
||||||
function heartbeat(): void {
|
function heartbeat(): void {
|
||||||
if (stream != null && document.visibilityState === 'visible') {
|
if (stream != null && document.visibilityState === 'visible') {
|
||||||
stream.send('ping');
|
stream.heartbeat();
|
||||||
}
|
}
|
||||||
window.setTimeout(heartbeat, 1000 * 60);
|
window.setTimeout(heartbeat, 1000 * 60);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,6 +186,14 @@ export default class Stream extends EventEmitter<StreamEvents> {
|
||||||
this.stream.send(JSON.stringify(typeOrPayload));
|
this.stream.send(JSON.stringify(typeOrPayload));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ping(): void {
|
||||||
|
this.stream.send('ping');
|
||||||
|
}
|
||||||
|
|
||||||
|
public heartbeat(): void {
|
||||||
|
this.stream.send('h');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close this connection
|
* Close this connection
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue