mirror of
https://github.com/colanode/colanode.git
synced 2025-12-29 00:25:03 +01:00
Send pings for socket connections from desktop
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user