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,
|
||||
isPlayerChoosing: false,
|
||||
chosenEntry: undefined,
|
||||
keepAliveInterval: undefined,
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
@ -222,6 +223,9 @@ export const useGameStore = defineStore('game', {
|
|||
}, 5000);
|
||||
|
||||
this.websocketConnection.onopen = ( _event ) => {
|
||||
this.keepAliveInterval = setInterval( () => {
|
||||
this.sendEvent("keepAlive", {} );
|
||||
}, 55000);
|
||||
clearTimeout(timeout);
|
||||
resolve();
|
||||
}
|
||||
|
|
@ -244,6 +248,8 @@ export const useGameStore = defineStore('game', {
|
|||
console.error("Websocket Error");
|
||||
};
|
||||
this.websocketConnection.onclose = ( event ) => {
|
||||
clearInterval( this.keepAliveInterval );
|
||||
this.keepAliveInterval = undefined;
|
||||
const userStore = useUserStore();
|
||||
userStore.resetInitialUserDataPromise();
|
||||
userStore.initialUserPromise
|
||||
|
|
|
|||
Loading…
Reference in New Issue