Skip to content

Commit 3e798dd

Browse files
committed
Support non-reconnecting websockets
- treat a recconectDelay of -1 as meaning do not attempt to reconnect - reconnecting is not always desirable - for example when using firefly-sdk as a websocket proxy Signed-off-by: Chris Bygrave <[email protected]>
1 parent 4d2aa8e commit 3e798dd

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/websocket.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ export class FireFlyWebSocket {
148148
if (!this.reconnectTimer) {
149149
this.close();
150150
this.logger.error(`Websocket closed: ${msg}`);
151-
this.reconnectTimer = setTimeout(() => this.connect(), this.options.reconnectDelay);
151+
if (this.options.reconnectDelay === -1) {
152+
// do not attempt to reconnect
153+
} else {
154+
this.reconnectTimer = setTimeout(() => this.connect(), this.options.reconnectDelay);
155+
}
152156
}
153157
}
154158

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyperledger/firefly-sdk",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "Client SDK for Hyperledger FireFly",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)