Skip to main content
Version: v8.0.0

LatestDeliveryType

Sampling delivery. The first message of an idle period is delivered immediately (when leading is true ), then at most one message per interval is delivered - always the most recent one. Intermediate messages are dropped. Best for state-like data (prices, positions, cursors) where only the newest value matters.


Import
import { LatestDeliveryType } from "@hyper-fetch/sockets"

Preview​

type LatestDeliveryType = {
interval: number;
leading?: boolean;
strategy: latest;
}

Structure​

LatestDeliveryType
NameTypeDescription
interval
number

Minimum time in milliseconds between two deliveries.

leading
boolean

Deliver the first message of an idle period immediately instead of waiting for the interval to pass.

strategy
latest