Electron IPC Integration
Electron IPC is a built-in IPC mechanism in Electron that allows you to communicate between the main process and renderer processes. For additional context, refer to the IPC Adapter guide.
Basic
main script: Create and upgrade an oRPC handler.
tsimport { app } from 'electron' import { experimental_RPCHandler as RPCHandler } from '@orpc/server/electron-ipc' const handler = new RPCHandler(router) app.whenReady().then(() => { handler.upgrade({ context: {}, // Provide initial context if needed }) })
preload script: Expose the oRPC handler channel to the renderer process.
tsimport { experimental_exposeORPCHandlerChannel as exposeORPCHandlerChannel } from '@orpc/server/electron-ipc' exposeORPCHandlerChannel()
renderer script: Create an oRPC link and use it to initialize the client.
tsimport { experimental_RPCLink as RPCLink } from '@orpc/client/electron-ipc' const link = new RPCLink()
INFO
This only shows how to configure the link. For full client examples, see Client-Side Clients.