#communicate with main process from web workers

2 messages · Page 1 of 1 (latest)

ashen sedge
#

Hello, I am using web workers in order to run background tasks. When the user types a shortcut, I want the application to do some things.

The problem I face to, is that I want to send messages to the main process from the web worker context.
I've tried using IPC with ipcRenderer and ipcMain, but ipcRenderer is not available in web workers contexts...
Do you have any alternative ?

floral pecan
#

I can think of 2 options:

  1. Use websocket but will also need websocket server in main.

  2. Pass required data through webworker postMessage and send them to main through parent renderer.