Added ws keep alive event on 55 second interval
This commit is contained in:
parent
c8adc77938
commit
d0ca20b162
|
|
@ -25,6 +25,7 @@ export const useGameStore = defineStore('game', {
|
||||||
acceptAnswers: false,
|
acceptAnswers: false,
|
||||||
isPlayerChoosing: false,
|
isPlayerChoosing: false,
|
||||||
chosenEntry: undefined,
|
chosenEntry: undefined,
|
||||||
|
keepAliveInterval: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -222,6 +223,9 @@ export const useGameStore = defineStore('game', {
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
this.websocketConnection.onopen = ( _event ) => {
|
this.websocketConnection.onopen = ( _event ) => {
|
||||||
|
this.keepAliveInterval = setInterval( () => {
|
||||||
|
this.sendEvent("keepAlive", {} );
|
||||||
|
}, 55000);
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +248,8 @@ export const useGameStore = defineStore('game', {
|
||||||
console.error("Websocket Error");
|
console.error("Websocket Error");
|
||||||
};
|
};
|
||||||
this.websocketConnection.onclose = ( event ) => {
|
this.websocketConnection.onclose = ( event ) => {
|
||||||
|
clearInterval( this.keepAliveInterval );
|
||||||
|
this.keepAliveInterval = undefined;
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
userStore.resetInitialUserDataPromise();
|
userStore.resetInitialUserDataPromise();
|
||||||
userStore.initialUserPromise
|
userStore.initialUserPromise
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue