Reconnect with exponential backoff flag: enableReconnect (#507)

https://github.com/nbd-wtf/nostr-tools/pull/507
This commit is contained in:
Chris McCormick
2025-09-30 21:01:07 +08:00
committed by GitHub
parent 226d7d07e2
commit bc1294e4e6
7 changed files with 431 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
/* global WebSocket */
import { verifyEvent } from './pure.ts'
import { AbstractSimplePool } from './abstract-pool.ts'
import { AbstractSimplePool, type AbstractPoolConstructorOptions } from './abstract-pool.ts'
var _WebSocket: typeof WebSocket
@@ -14,7 +14,7 @@ export function useWebSocketImplementation(websocketImplementation: any) {
}
export class SimplePool extends AbstractSimplePool {
constructor(options?: { enablePing?: boolean }) {
constructor(options?: Pick<AbstractPoolConstructorOptions, 'enablePing' | 'enableReconnect'>) {
super({ verifyEvent, websocketImplementation: _WebSocket, ...options })
}
}