diff --git a/plugins/client-resources/src/connection.ts b/plugins/client-resources/src/connection.ts index 514d3ccd77..66a6af3fe9 100644 --- a/plugins/client-resources/src/connection.ts +++ b/plugins/client-resources/src/connection.ts @@ -51,6 +51,11 @@ class Connection implements Storage { this.handler(resp.result as Tx) } } + const interval = setInterval(() => { + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.sendRequest('ping') + }, 10000) + this.webSocket.onclose = () => { console.log('client websocket closed'); clearInterval(interval) } } private sendRequest (method: string, ...params: any[]): Promise { diff --git a/server/ws/src/server.ts b/server/ws/src/server.ts index b7bea54f1a..620500e844 100644 --- a/server/ws/src/server.ts +++ b/server/ws/src/server.ts @@ -39,6 +39,8 @@ class Session implements Storage { private readonly storage: ServerStorage ) {} + async ping (): Promise { return 'pong!' } + async findAll (_class: Ref>, query: DocumentQuery, options?: FindOptions): Promise> { return await this.storage.findAll(_class, query, options) }