useWebSocketImplementation() on relay.ts

This commit is contained in:
fiatjaf
2024-02-14 13:19:48 -03:00
parent 7b0458db72
commit 01f13292bb
3 changed files with 15 additions and 4 deletions

View File

@@ -92,10 +92,11 @@ await relay.publish(signedEvent)
relay.close()
```
To use this on Node.js you first must install `websocket-polyfill` and import it:
To use this on Node.js you first must install `ws` and call something like this:
```js
import 'websocket-polyfill'
import { useWebSocketImplementation } from 'nostr-tools/relay'
useWebSocketImplementation(require('ws'))
```
### Interacting with multiple relays