Skip to content
Discussion options

You must be logged in to vote

@present-g @NotAFlightRisk

Done ✅ #147

It's a delivery option on the listener, almost exactly as you sketched it (top-level instead of inside options, since options is adapter-specific):

// sampling - first message immediately, then the newest one per interval
const onPrice = socket.createListener<Price>()({
  topic: "prices",
  delivery: { strategy: "latest", interval: 16 },
});

// batching - everything from the window as one array, nothing dropped
const onTrade = socket.createListener<Trade>()({
  topic: "trades",
  delivery: { strategy: "batch", interval: 100, maxSize: 500 },
});
onTrade.listen(({ data }) => {}); // data: Trade[] - inferred

// anything else - custom strategy
delivery: …

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@present-g
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@NotAFlightRisk
Comment options

@present-g
Comment options

@prc5
Comment options

prc5 Oct 8, 2026
Maintainer

@present-g
Comment options

Answer selected by prc5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants