Demonstrates ARCP v1.1's flow-control: session.ack lets clients
acknowledge the highest event_seq they've processed; the runtime
tracks per-session lag (highest emitted - lastAcked) and surfaces a
back_pressure status when lag exceeds its threshold.
In this demo the client opts into autoAck but deliberately starves
it — long interval, huge delta threshold — so the server's
backPressureThreshold: 200 is crossed quickly during a 2000-event
metric burst.
In one terminal:
pnpm tsx examples/ack-backpressure/server.tsIn a second terminal:
pnpm tsx examples/ack-backpressure/client.tsThe client prints the back-pressure status event when the runtime observes the lag.
- §6.5
session.ackflow control and consumer-lag detection. - §8.2
status { phase: "back_pressure" }runtime-emitted event.
| Env var | Default | Used by |
|---|---|---|
ARCP_DEMO_PORT |
7886 |
server |
ARCP_DEMO_URL |
ws://127.0.0.1:7886/arcp |
client |
ARCP_DEMO_TOKEN |
demo-token |
both |