adamritter / nostr-relaypool-ts

A Nostr RelayPool implementation in TypeScript using only nostr-tools library as a dependency
https://www.npmjs.com/package/nostr-relaypool
MIT License
63 stars 17 forks source link

Allow subscription batching by delaying subscriptions #8

Closed adamritter closed 1 year ago

adamritter commented 1 year ago

Adding maxDelay option delays sending subscription requests, batching them and matching them after the events come back.

It's called maxDelay instead of delay, as subscribing with a maxDelay of 100ms and later subscribing with infinity time will reset the timer to 100ms delay.

The first implementation probably just uses matchFilter (O(n^2)) for redistributing events that can be easily optimized if the abstraction is successful.