mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-10-28 14:19:48 +00:00
Handle ws errors on send/ping
This commit is contained in:
1 parent
a8f0081385
commit
20d8b21adc
2 files changed
+23
-3
No files matched your search
@@ -120,7 +120,13 @@ export default class Feed {
|
||||
}
|
||||
|
||||
public sendData(data: FeedMessage.Data) {
|
||||
this.socket.send(data);
|
||||
try {
|
||||
this.socket.send(data);
|
||||
} catch (err) {
|
||||
console.error('Failed to send data to a Feed', err);
|
||||
|
||||
this.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public sendMessage(message: FeedMessage.Message) {
|
||||
@@ -139,7 +145,14 @@ export default class Feed {
|
||||
return;
|
||||
}
|
||||
this.waitingForPong = true;
|
||||
this.socket.ping(noop);
|
||||
|
||||
try {
|
||||
this.socket.ping(noop);
|
||||
} catch (err) {
|
||||
console.error('Failed to send ping to Feed', err);
|
||||
|
||||
this.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private sendMessages = () => {
|
||||
|
||||
@@ -243,7 +243,14 @@ export default class Node {
|
||||
// }
|
||||
|
||||
this.pingStart = now;
|
||||
this.socket.ping(noop);
|
||||
|
||||
try {
|
||||
this.socket.ping(noop);
|
||||
} catch (err) {
|
||||
console.error('Failed to send ping to Node', err);
|
||||
|
||||
this.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private updateBestBlock(update: BestBlock) {
|
||||
|
||||
Reference in new issue
Block a user