Create a new throttled wrapper around a DirectIpcRenderer instance
The DirectIpcRenderer instance to wrap
Optional configuration
ReadonlydirectThe underlying DirectIpcRenderer instance Use this for non-throttled operations like invoke/handle
ReadonlygetGet the current default timeout
ReadonlygetGet the current array of all registered target processes
ReadonlygetGet this process's identifier
The identifier string or undefined if not set
ReadonlyhandleProxy methods (bound in constructor)
Register a handler for invoke calls on a specific channel
ReadonlyinvokeInvoke a handler on a remote renderer using a TargetSelector Note: Only single-target selectors are supported (not allIdentifiers/allUrls)
// Invoke on specific webContentsId
const result = await directIpc.invoke({ webContentsId: 123 }, 'get-data', arg1, arg2)
// Invoke on identifier (throws if multiple matches)
const result = await directIpc.invoke({ identifier: 'output' }, 'get-data', arg1, arg2)
// Invoke on URL pattern (throws if multiple matches)
const result = await directIpc.invoke({ url: /^https://example/ }, 'get-data', arg1, arg2)
// With timeout option
const result = await directIpc.invoke({ identifier: 'output' }, 'get-data', arg1, { timeout: 5000 })
ReadonlyrefreshManually refresh the map from main process
ReadonlyremoveReadonlyresolveResolve a target to its webContentsId using the local map
ReadonlysetSet the default timeout for invoke calls
ReadonlysetSet or update this renderer's identifier
The identifier string to set (must be one of TIdentifierStrings)
Access to localEvents emitter for non-throttled DirectIpc internal events (target-added, target-removed, map-updated, message)
Remove a throttled listener
Channel name
Handler function to remove
This instance for chaining
Register a listener for throttled message reception
Multiple messages on the same channel received in one tick will be coalesced, and the listener will be called once with the latest value on the next microtask.
Channel name to listen on
Handler function (receives sender + message args)
This instance for chaining
Send a message to target renderer(s) using a TargetSelector (throttled)
Multiple calls to the same target+channel in one tick will be coalesced, keeping only the latest message. The message is sent on the next microtask.
TargetSelector specifying which renderer(s) to send to
Message channel name
Message arguments
// Send to single identifier (throttled)
directIpc.throttled.send({ identifier: 'output' }, 'cursor-position', x, y)
// Send to webContentsId (throttled)
directIpc.throttled.send({ webContentsId: 123 }, 'update', data)
// Send to all matching identifiers (throttled)
directIpc.throttled.send({ allIdentifiers: /^output/ }, 'broadcast', msg)
DirectIpcThrottled - Lossy Message Coalescing
Note: You typically access this via
directIpc.throttledrather than creating instances directly. DirectIpcRenderer automatically creates a throttled instance.Provides automatic message throttling using microtask coalescing. This is a lossy communication pattern where intermediate messages are dropped, keeping only the latest message per event loop tick.
How It Works
Send-side coalescing:
Receive-side coalescing:
When to Use Throttled Messages
✅ Use
directIpc.throttledwhen:❌ Use regular
directIpcwhen:Checklist for Correct Usage
Before using
.throttled, verify ALL of these are true:If ANY of these are false, use regular
directIpcmethods instead.Examples
Performance Characteristics
Thread Safety
This class is designed for single-threaded use within one renderer process. It is NOT thread-safe across Web Workers or multiple processes.
Example