@gd-kirie/ipc
v0.1.2
Published
Thin browser-side IPC transport for Kirie WebView pages.
Readme
@gd-kirie/ipc
Thin browser-side IPC transport for Kirie WebView pages.
The package is imported by web content running inside a Kirie WebView. Native platforms continue to provide the low
level bridge on globalThis, and this package only wraps that bridge with a small typed module API.
API
import { onTextReceived, sendText } from "@gd-kirie/ipc";
sendText(JSON.stringify({
type: "web_ready",
}));
const unsubscribe = onTextReceived((message) => {
console.log(message);
});
unsubscribe();The package selects the native transport from window.kirie.platform, which is
injected by Kirie before page scripts run.
Android exposes three channels backed by CBOR packets and AndroidX WebKit ArrayBuffer messages. iOS exposes the same lane API over WKWebView script messages, carrying each CBOR packet as base64 inside the platform string message:
sendText()/onTextReceived()for CBOR text stringssendBinary()/onBinaryReceived()for CBOR byte stringssendData()/onDataReceived()for CBOR-encoded structured data throughcborg
The structured data subset is limited to null, booleans, numbers, strings,
arrays, and objects with string keys. JSON message shapes are a caller or
adapter convention and should be sent with sendText() when needed.
