Electron's IPC not sending/receiving

February 17, 2018

Having problems sending and receiving data via Electron’s IPC module? This might be the culprit. To use IPC, you need to make sure that your listener window did-finish-load. Otherwise, your data will just fade into the ether.

Main
yourWindow.webContents.on('did-finish-load', () => {
	yourWindow.webContents.send('testChannel', 'Hello world!')
})
Renderer
ipcRenderer.on('testChannel', (event, data) => {
	console.log(data)
})

Want more?

My newsletter sends rarely. It's where I share updates on the best of my writing: introverted entrepreneurship, esoteric mindset tips, notes from great books, and automating businesses as a solo-owner so they run by themselves. Want to join?

Subscribe