Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 3.44 KB

File metadata and controls

59 lines (46 loc) · 3.44 KB
title Browser-Side API
navigation
icon
i-lucide-globe
description Lookup tables for the browser side: connectDevframe options, RPC client events, connection statuses, and in-page channel error codes.

Lookup tables for a devframe's browser side. Each section links the guide page that teaches the concept.

connectDevframe options

The options of connectDevframe() / getDevframeRpcClient(): Client.

Option Description
connection Connection prepared by setupDevframeConnection().
baseURL Mount path to probe for __connection.json (array = fallback). Default './' (relative to document.baseURI); use an absolute path ('/__devframe/') from outside the SPA.
authToken Override the auth token (default: a locally-persisted id).
cacheOptions true for default caching, or an options object.
callTimeout Ms before a pending rpc.call rejects with a 'timeout' DevframeConnectionError; 0/omit = wait forever.
wsOptions Transport overrides: onConnected / onError / onDisconnected hooks, socket URL.
rpcOptions Forwarded to birpc.
connectionMeta Descriptor that skips the __connection.json fetch.

RPC client events

Emitted over rpc.events: Events.

Event Fires when
rpc:is-trusted:updated Trust granted, denied, or revoked. Carries the new isTrusted boolean.
connection:status The connection status changes. Carries (status, previous).
connection:error A connection-level failure: socket error or trust refused. Carries the Error.
rpc:error An rpc.call rejects, from the node side or a down connection. Carries (error, method).

Connection statuses

The values of rpc.status: Handling connection and auth errors.

Status Meaning
connecting Establishing socket / handshake. Calls queue until open.
connected Socket open and trusted; calls are served.
unauthorized Socket open, trust refused. Prompt for authentication.
disconnected Socket closed (dropped mid-session or never opened).
error Fatal: the socket errored or connection meta couldn't load.

In-page channel error codes

The error.code values of InPageChannelError: Errors and fallbacks.

Code When What to do
timeout A call outlived callTimeoutMs (default 15s), or whenConnected(ms) expired The message carries the endpoint status: connecting usually means the page script isn't loaded in this context
closed The endpoint was closed with calls pending Expected during teardown
not-serializable A jsonSerializable: true payload contained a non-JSON value The message names the offending path (e.g. its arguments[0].nodes[2] is a Map)
not-cloneable The port refused to clone a payload (DataCloneError) Strip functions/DOM nodes/reactivity proxies, or declare jsonSerializable: true for the precise error above
invalid-args Incoming arguments failed their Standard-Schema validation The message lists the schema issues
state-uninitialized The page script read a shared state before providing its initialValue Initialize on first access