make relay.connect() an awaitable thing.

This commit is contained in:
fiatjaf
2022-12-22 08:52:34 -03:00
parent 8262a81cb2
commit ac698ef67d
3 changed files with 61 additions and 57 deletions

View File

@@ -53,7 +53,7 @@ import {
} from 'nostr-tools'
const relay = relayInit('wss://relay.example.com')
relay.connect()
await relay.connect()
relay.on('connect', () => {
console.log(`connected to ${relay.url}`)