Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MercuryWorkshop/epoxy-tls/llms.txt
Use this file to discover all available pages before exploring further.
EpoxyClient is the core class of the Epoxy TLS library. Once constructed with a valid Wisp transport and an EpoxyClientOptions instance, it exposes a fetch API compatible with the browser’s native fetch, as well as raw TCP, TLS, and UDP stream methods. WebSocket proxying is available in the full build via connect_websocket.
Constructor
EpoxyClient and validates the provided transport. Throws an EpoxyError if the transport URL scheme is invalid or the transport value is not a recognized type.
The Wisp server transport. Accepts either:
- A WebSocket URL string (
ws://orwss://) pointing to a Wisp server, or - A function
() => Promise<EpoxyWispTransportResult> | EpoxyWispTransportResultthat returns a{ read: ReadableStream<ArrayBuffer>, write: WritableStream<Uint8Array> }object.
Configuration for the connection. Construct with
new EpoxyClientOptions() and set fields directly before passing. See EpoxyClientOptions.Methods
fetch
fetch signature.
The request URL. Must use the
http or https scheme.A fetch-like options object. Supported fields:
method— HTTP method string (default:"GET")headers— AHeadersinstance or a plain{ [key: string]: string }objectbody— Request body:string,Uint8Array,ArrayBuffer,ReadableStream,URLSearchParams, orFormDataredirect—"follow"(default),"manual", or"error"
Promise<Response> — a standard Web API Response object. The response also exposes two extra properties:
response.rawHeaders— a plain object of raw (un-folded) header values, where duplicate header names are represented as arrays.response.redirected—trueif the request was redirected.
connect_websocket (full build only)
EpoxyWebSocket handle.
connect_websocket is only available in the full build (@mercuryworkshop/epoxy-tls/epoxy or @mercuryworkshop/epoxy-tls/epoxy-bundled). It is not present in the minimal build.An
EpoxyHandlers instance carrying the four event callbacks. See EpoxyHandlers.The WebSocket endpoint URL (e.g.,
"wss://echo.websocket.events").Subprotocol list to advertise during the handshake. Pass an empty array
[] if no subprotocol is needed.Extra HTTP headers to send with the WebSocket upgrade request, such as authentication headers.
Promise<EpoxyWebSocket>
connect_tcp
Target address in
"host:port" authority form, e.g. "example.com:80". Pass a URL object or a full URI string such as "tcp://example.com:80" if you prefer — the host and port are extracted from either form. A port is required.Promise<EpoxyIoStream> — { read: ReadableStream<Uint8Array>, write: WritableStream<Uint8Array> }. See Streams.
connect_tls
Target address in
"host:port" authority form, e.g. "example.com:443". The host name is also used as the TLS Server Name Indication (SNI) value. A port is required.Promise<EpoxyIoStream> — { read: ReadableStream<Uint8Array>, write: WritableStream<Uint8Array> }. See Streams.
connect_udp
write call sends one datagram; each read yields one datagram.
Target address in
"host:port" authority form, e.g. "127.0.0.1:5000". A port is required.Promise<EpoxyIoStream> — { read: ReadableStream<Uint8Array>, write: WritableStream<Uint8Array> }. See Streams.
replace_stream_provider
Promise<void>
Public Properties
These properties can be read and written directly on a client instance after construction.Maximum number of HTTP redirects to follow before returning the last response as-is. Defaults to
10. Set to 0 to disable automatic redirect following (equivalent to redirect: "manual").The
User-Agent header value sent with every fetch request. Defaults to the Chrome UA string set in EpoxyClientOptions. Can be overridden at any time.Internal read-buffer size in bytes used when bridging async Rust streams to Web Streams. Defaults to
16384 (16 KiB). Larger values may improve throughput at the cost of memory.Usage Example
connect_websocket and the ws_title_case_headers option are only available in the full build. The minimal build (@mercuryworkshop/epoxy-tls/minimal / minimal-bundled) omits them to reduce bundle size.