Skip to content

IPC

Renderer ↔ main RPC for the plugin. Requires the ipc permission.

Renderer

Call hc.ipc.invoke(channel, ...args) instead of window.api.invokePluginMain.

Main entry

Use hc.ipc.handle in the main entry to serve channels that the renderer calls with hc.ipc.invoke.

hc.ipc.handle(channel, handler)

Available since v2.0.0

Signature:(channel: string, handler: (...args) => unknown) => Disposable

Expose an RPC channel callable from the renderer half of the same plugin. Requires the ipc permission.

Main-process hooks are invoked by posting work to the utilityProcess runner; the main process applies mutations and enforces permissions before and after each callback.

See the Request logger example for a main-only plugin using HTTP hooks.

hc.ipc.invoke(channel, ...args)

Available since v2.0.0

Signature:<T>(channel: string, ...args: unknown[]) => Promise<T>

Invokes a handler registered with hc.ipc.handle in the main entry. Use hc.pluginId for logging — channel names are automatically scoped to your plugin.

Do not call window.api.invokePluginMain directly — use this typed API instead.

typescript
const pending = await hc.ipc.invoke<Array<{ id: string }>>('pullPending');