tars:init into the page, which the bridge requires.
Requirements
WKWebViewfrom WebKit- A
WKScriptMessageHandlerregistered under the nametarsbridge - Enable Bridge Events turned on for the agent
Snippet
Message wiring
The init script runs on the page load event, which can fire before the widget mounts. A
tars:init posted that early is dropped and never answered. Resend tars:init until a tars:ready carrying capabilities arrives, because a repeat init after the handshake is ignored. The snippet above posts the init once, so add the resend before you ship it.
Handle at least tars:navigate, tars:data, and tars:close: the three capabilities the bridge declares in its tars:ready reply to tars:init. Field-level payloads for every message are in the bridge events reference.
