@ekrooh/bare/transports
The transports subpath exports the UI-facing transport surface.
Exports
Section titled “Exports”MessageTransport(type) —send(type, header, payload?)+subscribe(handler)+ optionalclose().createWebSocketTransport(urlOrOptions?)— same-origin default, cookie bootstrap, reconnect with backoff.createMockTransport()— deterministic, in-process responses for tests and browser dev, routed through the real plugin kernel. It is part of the transports bundle; select it only behind a dev/test guard.
Options
Section titled “Options”createWebSocketTransport accepts a URL string or options:
url?— defaultws://<location.host>; browser dev passesVITE_BARE_WS_URLexplicitly.login?— defaulttrue: bootstrap thebare_session_<port>cookie viaPOST /loginwhenwindow.__ekrooh.bootstrapis present. The raw session token is never a login credential.maxRetries?— default 5. Applies only before the first connect, and only onceminBootWindowMshas passed; a client that has connected retries forever.backoffMs?— default 250, doubling to a 2s cap (equal jitter).loginTimeoutMs?— default 2000: how long/loginmay take.minBootWindowMs?— default 10000: a never-connected client gives up only after this long.openTimeoutMs?— default 10000: a socket still connecting after this is dropped and retried.maxQueued?— default 256: requests held while connecting; past it, new requests fail fast withTRANSPORT_ERROR.diagnostics?— defaultfalse: fold the server’s recent[loopback]rejection lines into the give-up error.
Invokes already sent fail with TRANSPORT_ERROR when their socket is lost. A
socket the server replaced (close code 4001) reconnects after 30 s or when the
page returns to the foreground. See Transports
for the full reconnect rules.
The transport never places a credential in a URL — there is no ?token=
fallback.
import { createWebSocketTransport } from '@ekrooh/bare/transports';
const transport = createWebSocketTransport();