Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

btv.connect

btv.connect.register(scheme_or_matcher, resolver)

btv.connect.register(scheme_or_matcher, resolver) — register a connector.

  • scheme_or_matcher — either a scheme string ("container", "ssh"), matched against the URL’s scheme:// prefix, or a matcher function fn(url) -> boolean for host-pattern routing (e.g. only *.internal hosts).
  • resolver — fn(url) -> spec. It resolves url to a session-swap spec (the table btv.session.reconnect takes: { transport = …, config_source = …, keep_buffers = … }). spec.config_source (§D) picks whose config the swapped session runs — "remote" (default; the daemon’s config + plugins) or "local" (this machine’s config, the daemon backing only the seams — the dev-container shape). It MAY provision asynchronously — return a promise that fulfils with the spec — and MAY stream progress with btv.notify (“detecting arch…”, “starting daemon…”).

Registering the same scheme twice keeps both; the later wins (reverse scan in _resolve). Fails LOUD on a bad argument (a mistyped registration is a bug, not a silent no-op).

Defined in connect.lua.

btv.connect.connect(url)

btv.connect.connect(url) — the :connect entry point (also callable directly). Route url through the provider registry: a matching resolver runs (async-aware) and its spec swaps the window (§B); with no provider, hand url to the client’s built-in direct dial. A resolver error / a non-spec return surfaces LOUD (a message), leaving the session intact — the swap only happens once a valid spec resolves.

Defined in connect.lua.