worker-http

npm

HTTP client for Web Workers with interceptors, retry logic, and caching.

TypeScriptmain.ts
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.

Explore API→

createWorkerPipeline

Creates a request pipeline inside the worker using pure-function interceptors. No Angular DI, no DOM access β€” just (req, next) => Promise.

Explore API→

Serializers

Pluggable serialization for the postMessage boundary. Structured clone (zero overhead), seroval (full type fidelity), or auto-detect (smart selection).

Explore API→

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.

Explore API→

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.

Explore API→

Streams Polyfill

Safari Transferable Streams Ponyfill. Provides ReadableStream, TransformStream, and WritableStream implementations that support structuredClone transfer to/from Web Workers on Safari 16-17.

Explore API→

esbuild Plugin

Build-time esbuild plugin for bundling worker interceptors. Auto-discovers and injects interceptor imports into worker files during compilation.

Explore API→

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.

Explore API→
LCP N/A
CLS N/A
INP N/A