Is it possible to build a multi-threaded application using Electron?

Note: I’m not exactly web developer but I prefer using WebGL to develop hardware-accelerated graphics applications for the web. The problem is that sometimes I include a physics engine into my app which uses CPU (a lot). I’d like to execute all (or some) physics calculations on one thread, and make draw calls on different thread, thus exploiting client’s multi-core processor. Is it possible with Electron?


You can use Web Workers in the renderer process, but keep in mind that Node integration is disabled in web workers because Node is not thread-safe. Another option is a native Node module that spawns as many worker threads as it wants, though you’ll obviously need to synchronize access to Node. A third option is to spawn another Node process to do some of the work.