Overview
Non-normative guidance for host implementers on iOS, macOS, Android, Windows, and Linux.
These pages show one way to satisfy the Contract on each platform. They are non-normative: where they differ from the Contract, the Contract wins. Treat the code as a starting point, not a copy-paste drop-in.
A conforming host, on any platform, must:
- Expose the
todayWebViewBridgechannel as an object with apostMessage(message): Promisesurface. - Dispatch on the message
typeand implementtrack,headers, andrefreshTokenper Capabilities. - Resolve
undefinedfor any unknowntype— never reject. - Reject with a non-empty error string only where the Contract allows it
(
refreshToken). - Coalesce concurrent
refreshTokencalls into a single real refresh.
The platform difference is entirely in how the promise-returning channel is
constructed. Apple WebViews get it for free; Android and WebView2 wrap their
transport in a thin shim; Electron exposes an isolated preload facade. Every
path restores the same postMessage(message): Promise surface.
- iOS —
WKScriptMessageHandlerWithReply. - macOS — an AppKit
WKWebViewhandler or the Electron desktop preload facade. - Android —
WebViewCompat.addWebMessageListeneror a@JavascriptInterface+ callback shim. - Windows — WebView2 host object,
chrome.webview.postMessage+ request-id shim, or the Electron desktop preload facade. - Linux — Electron
contextBridge+ main-process IPC in the full desktop app shell.
Several platforms share a transport and cannot be told apart from the channel
shape alone — iOS vs macOS both use WKWebView, while Android vs Linux vs
Windows expose a global channel object. Each host MUST inject the
platform tag when the channel shape is ambiguous.