When using ably-js in Electron from a renderer process, the renderer process crashes after ~30s

The cause of the issue appears to be a bug in Electron when chromium's setTimeout function is called by an electron renderer (BrowserWindow) process from a script evaluated in a custom vm context (which ably-js does).

 

One solution is to use Ably from the main process (or a worker thread spawned off from it), instead of from a renderer process. Since the main process is a normal node.js process, it does not suffer from the same issue.

 

If you must run Ably from a renderer process, as a workaround we have a build of ably-js that avoids using a custom vm context. If you would like to use this, please contact us to ask how. This is so we can keep track of who is using the workaround, and let them know when we have a more permanent solution. We are in the process of evaluating more permanent solutions.