mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-26 09:44:25 +01:00
23 lines
649 B
TypeScript
23 lines
649 B
TypeScript
import { RelayPoolWorker } from 'nostr-relaypool';
|
|
|
|
import { getActiveRelays } from '@/db/relays.ts';
|
|
|
|
const activeRelays = await getActiveRelays();
|
|
|
|
console.log(`pool: connecting to ${activeRelays.length} relays.`);
|
|
|
|
const worker = new Worker('https://unpkg.com/nostr-relaypool2@0.6.34/lib/nostr-relaypool.worker.js', {
|
|
type: 'module',
|
|
});
|
|
|
|
// @ts-ignore Wrong types.
|
|
const pool = new RelayPoolWorker(worker, activeRelays, {
|
|
autoReconnect: true,
|
|
// The pipeline verifies events.
|
|
skipVerification: true,
|
|
// The logging feature overwhelms the CPU and creates too many logs.
|
|
logErrorsAndNotices: false,
|
|
});
|
|
|
|
export { activeRelays, pool };
|