mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-12 10:08:49 +00:00
Improvements to enablePing() & tests (#506)
https://github.com/nbd-wtf/nostr-tools/pull/506
This commit is contained in:
8
relay.ts
8
relay.ts
@@ -14,12 +14,12 @@ export function useWebSocketImplementation(websocketImplementation: any) {
|
||||
}
|
||||
|
||||
export class Relay extends AbstractRelay {
|
||||
constructor(url: string) {
|
||||
super(url, { verifyEvent, websocketImplementation: _WebSocket })
|
||||
constructor(url: string, options?: { enablePing?: boolean }) {
|
||||
super(url, { verifyEvent, websocketImplementation: _WebSocket, ...options })
|
||||
}
|
||||
|
||||
static async connect(url: string): Promise<Relay> {
|
||||
const relay = new Relay(url)
|
||||
static async connect(url: string, options?: { enablePing?: boolean }): Promise<Relay> {
|
||||
const relay = new Relay(url, options)
|
||||
await relay.connect()
|
||||
return relay
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user