FIX: remove the ping and pong overrides server side in favor of and idleTimeout and added a manual ping client side
This commit is contained in:
parent
5a1147866c
commit
9b64a970b5
7 changed files with 14 additions and 39 deletions
|
@ -26,6 +26,7 @@ import {
|
|||
QueryJitsiJwtMessage,
|
||||
SendJitsiJwtMessage,
|
||||
CharacterLayerMessage,
|
||||
PingMessage,
|
||||
SendUserMessage
|
||||
} from "../Messages/generated/messages_pb"
|
||||
|
||||
|
@ -42,6 +43,8 @@ import {
|
|||
} from "./ConnexionModels";
|
||||
import {BodyResourceDescriptionInterface} from "../Phaser/Entity/body_character";
|
||||
|
||||
const manualPingDelay = 20000;
|
||||
|
||||
export class RoomConnection implements RoomConnection {
|
||||
private readonly socket: WebSocket;
|
||||
private userId: number|null = null;
|
||||
|
@ -84,7 +87,9 @@ export class RoomConnection implements RoomConnection {
|
|||
this.socket.binaryType = 'arraybuffer';
|
||||
|
||||
this.socket.onopen = (ev) => {
|
||||
//console.log('WS connected');
|
||||
//we manually ping every 20s to not be logged out by the server, even when the game is in background.
|
||||
const pingMessage = new PingMessage();
|
||||
setInterval(() => this.socket.send(pingMessage.serializeBinary().buffer), manualPingDelay);
|
||||
};
|
||||
|
||||
this.socket.onmessage = (messageEvent) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue