OptionalhostHost → Webview. One-way events (no response expected).
OptionalhostHandled by the host. The webview calls these; bind with rpc.onRequest.
OptionalwebviewWebview → Host. One-way events (no response expected).
OptionalwebviewHandled by the webview. The host calls these with rpc.request.
Contract for a webview RPC channel. Define one interface per webview and reference it from both the extension host code (
createWebviewRpc) and the webview bundle (createWebviewRpcClient), so the two sides cannot drift.The two naming conventions here differ, because requests and events need different information. A request field is named after the side that answers it (
webviewRequestsare handled by the webview), since that's the side whose handler signature the types have to describe. An event field is named after the side that sends it (hostEventstravel host → webview), because a one-way message has no handler contract to pin down.