mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
wait a second before failing to send on a not yet connected websocket.
This commit is contained in:
5
relay.ts
5
relay.ts
@@ -175,7 +175,10 @@ export function relayInit(url: string): Relay {
|
||||
async function trySend(params: [string, ...any]) {
|
||||
let msg = JSON.stringify(params)
|
||||
if (!connected()) {
|
||||
return
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
if (!connected()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
try {
|
||||
ws.send(msg)
|
||||
|
||||
Reference in New Issue
Block a user