Skip to content

Commit 243cbcd

Browse files
committed
Test onerror
1 parent 13b6468 commit 243cbcd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-commsmanager",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"scripts": {

src/components/CommsManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ export default class CommsManager {
6969
}, 1000);
7070
}
7171
};
72+
73+
this.ws.onerror = (e) => {
74+
console.log(`Connection with ${CommsManager.adress} interrupted: ${e}`);
75+
setTimeout(function () {
76+
delete CommsManager.instance;
77+
CommsManager.instance = new CommsManager();
78+
}, 1000);
79+
};
7280
}
7381

7482
// Singleton behavior

0 commit comments

Comments
 (0)