Send pings for socket connections from desktop

This commit is contained in:
Hakan Shehu
2025-01-02 17:23:56 +01:00
parent 71600473f2
commit bff8b2c9e4
2 changed files with 5 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ declare module '@/main/jobs' {
export class ConnectSocketJobHandler implements JobHandler<ConnectSocketInput> {
public triggerDebounce = 0;
public interval = 1000 * 60;
public interval = 1000 * 30;
private readonly debug = createDebugger('job:connect-socket');

View File

@@ -28,7 +28,8 @@ export class SocketConnection {
public init(): void {
this.debug(`Initializing socket connection for account ${this.account.id}`);
if (this.isConnected()) {
if (this.socket && this.isConnected()) {
this.socket.ping();
return;
}
@@ -120,11 +121,13 @@ export class SocketConnection {
if (this.socket) {
this.debug(`Closing socket connection for account ${this.account.id}`);
this.socket.close();
this.socket = null;
}
}
public checkConnection(): void {
if (this.isConnected()) {
this.socket?.ping();
return;
}