mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
doc: fix order of commands to connect to relay
This commit is contained in:
@@ -60,8 +60,6 @@ import {
|
||||
} from 'nostr-tools'
|
||||
|
||||
const relay = relayInit('wss://relay.example.com')
|
||||
await relay.connect()
|
||||
|
||||
relay.on('connect', () => {
|
||||
console.log(`connected to ${relay.url}`)
|
||||
})
|
||||
@@ -69,6 +67,8 @@ relay.on('error', () => {
|
||||
console.log(`failed to connect to ${relay.url}`)
|
||||
})
|
||||
|
||||
await relay.connect()
|
||||
|
||||
// let's query for an event that exists
|
||||
let sub = relay.sub([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user