This commit is contained in:
ShahanaFarooqui 2022-12-27 19:30:39 -08:00
parent 26ebb316be
commit ada3c6caf3
3 changed files with 20 additions and 16 deletions

View File

@ -110,10 +110,14 @@ export class ECLWebSocketClient {
};
this.heartbeat = (eclWsClt) => {
this.logger.log({ selectedNode: eclWsClt.selectedNode, level: 'DEBUG', fileName: 'ECLWebSocket', msg: 'Websocket Server Heartbeat..' });
if (!eclWsClt.webSocketClient)
if (!eclWsClt.webSocketClient) {
return;
if (eclWsClt.webSocketClient.readyState !== 1)
}
;
if (eclWsClt.webSocketClient.readyState !== 1) {
return;
}
;
eclWsClt.webSocketClient.ping();
setTimeout(() => {
this.heartbeat(eclWsClt);

View File

@ -97,7 +97,6 @@ export class ECLWebSocketClient {
eclWsClt.reConnect = false;
}
};
};
public disconnect = (selectedNode: CommonSelectedNode) => {
@ -121,13 +120,14 @@ export class ECLWebSocketClient {
public heartbeat = (eclWsClt) => {
this.logger.log({ selectedNode: eclWsClt.selectedNode, level: 'DEBUG', fileName: 'ECLWebSocket', msg: 'Websocket Server Heartbeat..' });
if (!eclWsClt.webSocketClient) return;
if (eclWsClt.webSocketClient.readyState !== 1) return;
if (!eclWsClt.webSocketClient) { return };
if (eclWsClt.webSocketClient.readyState !== 1) { return };
eclWsClt.webSocketClient.ping();
setTimeout(() => {
this.heartbeat(eclWsClt);
}, 59 * 1000);
}
};
}
export const ECLWSClient = new ECLWebSocketClient();

View File

@ -1,12 +1,12 @@
export enum ECLWSEventsEnum {
PAY_RECEIVED = 'payment-received',
PAY_RELAYED = 'payment-relayed',
PAY_SENT = 'payment-sent',
PAY_SETTLING_ONCHAIN = 'payment-settling-onchain',
PAY_FAILED = 'payment-failed',
CHANNEL_OPENED = 'channel-opened',
CHANNEL_STATE_CHANGED = 'channel-state-changed',
CHANNEL_CLOSED = 'channel-closed',
ONION_MESSAGE_RECEIVED = 'onion-message-received'
}
PAY_RECEIVED = 'payment-received',
PAY_RELAYED = 'payment-relayed',
PAY_SENT = 'payment-sent',
PAY_SETTLING_ONCHAIN = 'payment-settling-onchain',
PAY_FAILED = 'payment-failed',
CHANNEL_OPENED = 'channel-opened',
CHANNEL_STATE_CHANGED = 'channel-state-changed',
CHANNEL_CLOSED = 'channel-closed',
ONION_MESSAGE_RECEIVED = 'onion-message-received'
}