worker-http
npmHTTP client for Web Workers with interceptors, retry logic, and caching.
import { provideWorkerHttpClient } from '@angular-helpers/worker-http/backend';
bootstrapApplication(AppComponent, {
providers: [
provideWorkerHttpClient({
workerUrl: new URL('./workers/http-api.worker', import.meta.url),
}),
],
});β Entry Points
createWorkerTransport
Typed RPC bridge between main thread and Web Worker. Wraps postMessage with request/response correlation, Observable API, and automatic cancellation on unsubscribe.
createWorkerPipeline
Creates a request pipeline inside the worker using pure-function interceptors. No Angular DI, no DOM access β just (req, next) => Promise.
Serializers
Pluggable serialization for the postMessage boundary. Structured clone (zero overhead), seroval (full type fidelity), or auto-detect (smart selection).
provideWorkerHttpClient
Angular HttpBackend replacement that routes HttpClient requests to Web Workers off the main thread. Drop-in integration with Angular DI β use WorkerHttpClient just like HttpClient.
WebCrypto Utilities
Standalone WebCrypto primitives for HMAC signing, AES-GCM encryption, and content hashing. Useful in workers and main thread; workers provide memory isolation for key material.
Streams Polyfill
Safari Transferable Streams Ponyfill. Provides ReadableStream, TransformStream, and WritableStream implementations that support structuredClone transfer to/from Web Workers on Safari 16-17.
esbuild Plugin
Build-time esbuild plugin for bundling worker interceptors. Auto-discovers and injects interceptor imports into worker files during compilation.
Realtime Clients
Off-main-thread WebSockets and Server-Sent Events (SSE) clients running inside Web Workers. Offloads high-frequency stream parsing and data filtering from the main thread, communicating status and message streams via Angular Signals and RxJS.