Fix pool sub example

This commit is contained in:
michaelhall923 2023-02-25 19:15:03 -05:00 committed by fiatjaf_
parent b8aa75b6e1
commit 9530849f0a
1 changed files with 6 additions and 8 deletions

View File

@ -140,16 +140,14 @@ let relays = ['wss://relay.example.com', 'wss://relay.example2.com']
let relay = await pool.ensureRelay('wss://relay.example3.com')
let subs = pool.sub([...relays, relay], {
let sub = pool.sub([...relays, relay], [{
authors: ['32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245']
})
}])
subs.forEach(sub =>
sub.on('event', event => {
// this will only be called once the first time the event is received
// ...
})
)
sub.on('event', event => {
// this will only be called once the first time the event is received
// ...
})
let pubs = pool.publish(relays, newEvent)
pubs.forEach(pub =>