Skip to content
On this page

Function: subscribe()

TypeScript
function subscribe(filter: Filter, opts: SubscribeOptions): Subscription;

Defined in: index.ts:914 (opens in a new tab)

Keep filter subscribed on every relay until stop(). Each relay's REQ is re-sent whenever its socket comes back, so a since filter backfills what was missed. Events are verified and filter-matched like queryEvents, and delivered once per id across all relays.

In a browser the subscription rides the page's pooled socket to each relay and holds one of its subscription slots while open.

ParametersLink to this section

ParameterType
filterFilter
optsSubscribeOptions

ReturnsLink to this section

Subscription