Get pingpong working in the browser with dummy REQ (#499)

This commit is contained in:
Chris McCormick
2025-07-24 22:22:15 +08:00
committed by GitHub
parent 4b6cc19b9c
commit 87f2c74bb3
5 changed files with 48 additions and 17 deletions

View File

@@ -133,6 +133,14 @@ import WebSocket from 'ws'
useWebSocketImplementation(WebSocket)
```
You can enable regular pings of connected relays with the `enablePing` option. This will set up a heartbeat that closes the websocket if it doesn't receive a response in time. Some platforms don't report websocket disconnections due to network issues, and enabling this can increase reliability.
```js
import { SimplePool } from 'nostr-tools/pool'
const pool = new SimplePool({ enablePing: true })
```
### Parsing references (mentions) from a content based on NIP-27
```js