Interface NDKSubscriptionOptions

interface NDKSubscriptionOptions {
    cacheUsage?: NDKSubscriptionCacheUsage;
    closeOnEose?: boolean;
    groupable?: boolean;
    groupableDelay?: number;
    groupableDelayType?: NDKSubscriptionDelayedType;
    pool?: NDKPool;
    skipOptimisticPublishEvent?: boolean;
    skipValidation?: boolean;
    skipVerification?: boolean;
    subId?: string;
}

Properties

closeOnEose?: boolean

Whether to close the subscription when all relays have reached the end of the event stream.

false
groupable?: boolean

Groupable subscriptions are created with a slight time delayed to allow similar filters to be grouped together.

groupableDelay?: number

The delay to use when grouping subscriptions, specified in milliseconds.

100
const sub1 = ndk.subscribe({ kinds: [1], authors: ["alice"] }, { groupableDelay: 100 });
const sub2 = ndk.subscribe({ kinds: [0], authors: ["alice"] }, { groupableDelay: 1000 });
// sub1 and sub2 will be grouped together and executed 100ms after sub1 was created
groupableDelayType?: NDKSubscriptionDelayedType

Specifies how this delay should be interpreted. "at-least" means "wait at least this long before sending the subscription" "at-most" means "wait at most this long before sending the subscription"

"at-most"
const sub1 = ndk.subscribe({ kinds: [1], authors: ["alice"] }, { groupableDelay: 100, groupableDelayType: "at-least" });
const sub2 = ndk.subscribe({ kinds: [0], authors: ["alice"] }, { groupableDelay: 1000, groupableDelayType: "at-most" });
// sub1 and sub2 will be grouped together and executed 1000ms after sub1 was created
pool?: NDKPool

Pool to use

skipOptimisticPublishEvent?: boolean

Skip emitting on events before they are received from a relay. (skip optimistic publish)

false
skipValidation?: boolean

Skip event validation

false
skipVerification?: boolean

Skip signature verification

false
subId?: string

The subscription ID to use for the subscription.