Trigg a disconnect event when keepalive signal lost

You will have to wait for DISCONNECT_TIMEOUT time berfore receiving event
This commit is contained in:
Stéphane ANCELOT 2024-06-26 14:11:13 +02:00 committed by GitHub
parent 062fb7d203
commit e3178bb61d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -91,7 +91,7 @@ const extendedClipboardActionProvide = 1 << 28;
export default class RFB extends EventTargetMixin {
constructor(target, urlOrChannel, options) {
if (!target) {
throw new Error("Must specify target");
throw new ("Must specify target");
}
if (!urlOrChannel) {
throw new Error("Must specify URL, WebSocket or RTCDataChannel");
@ -2508,6 +2508,7 @@ export default class RFB extends EventTargetMixin {
this._socketError(
"Keepalive timeout: No keepalive update received in the last 10 seconds."
);
this.disconnect();
}
// Function to reset the keepalive timer