nostr-tools
Advanced tools
Comparing version 0.8.1 to 0.9.0
{ | ||
"name": "nostr-tools", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -5,0 +5,0 @@ "repository": { |
15
relay.js
@@ -16,3 +16,3 @@ import 'websocket-polyfill' | ||
var ws, resolveOpen, untilOpen | ||
var ws, resolveOpen, untilOpen, wasClosed | ||
var openSubs = {} | ||
@@ -38,6 +38,9 @@ let attemptNumber = 1 | ||
// restablish old subscriptions | ||
for (let channel in openSubs) { | ||
let filters = openSubs[channel] | ||
let cb = channels[channel] | ||
sub({cb, filter: filters}, channel) | ||
if (wasClosed) { | ||
wasClosed = false | ||
for (let channel in openSubs) { | ||
let filters = openSubs[channel] | ||
let cb = channels[channel] | ||
sub({cb, filter: filters}, channel) | ||
} | ||
} | ||
@@ -63,2 +66,4 @@ } | ||
}, nextAttemptSeconds * 1000) | ||
wasClosed = true | ||
} | ||
@@ -65,0 +70,0 @@ |
18563
545
8