跳转到内容
#0848
Curl

Two hundred widgets, one WebSocket, no proxy tier

The ops dashboard renders two hundred widgets, each wanting data from somewhere else: the metrics API, the ticketing system, three vendor status pages. On page load that is two hundred TCP handshakes and TLS negotiations, plus a backend-for-frontend somebody keeps alive to get around the browser's cross-origin rules.

You swap the global fetch for createFetch from @hoody/curl-channel-sdk, pointed at the container's /api/v1/curl/channel. The tab opens one WebSocket. Every widget's fetch() rides it as its own stream, multiplexed, cancellable, returning status, headers and body like the real thing. The requests leave from the container, not the visitor's tab. When the socket drops, the SDK reconnects with backoff; a request issued during the gap waits for the next live socket instead of failing.

The backend-for-frontend you were about to write was a WebSocket the container already had.