correctly wait until connection to a relay is established

This commit is contained in:
jiftechnify
2023-12-20 23:15:33 +09:00
committed by fiatjaf_
parent 7552a36ff2
commit b7389be5c7
2 changed files with 14 additions and 10 deletions

View File

@@ -7,9 +7,9 @@ import { Queue, normalizeURL } from './utils.ts'
import { nip42 } from './index.ts'
import { yieldThread } from './helpers.ts'
export function relayConnect(url: string) {
export async function relayConnect(url: string) {
const relay = new Relay(url)
relay.connect()
await relay.connect()
return relay
}