sendToFrame

fun sendToFrame(frameId: Double, channel: String, vararg args: Any?)(source)
fun sendToFrame(frameId: JsTuple2<Double, Double>, channel: String, vararg args: Any?)(source)

Send an asynchronous message to a specific frame in a renderer process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.

NOTE: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.

The renderer process can handle the message by listening to channel with the ipcRenderer module.

If you want to get the frameId of a given renderer context you should use the webFrame.routingId value. E.g.

You can also read frameId from all incoming IPC messages in the main process.