WebRTC, peer discovery and web workers - best practices for IPFS app on Node, Electron and browser?

I was wondering if anyone could help guide me regarding best practices for connecting users of an app that is based on IPFS. I am trying to set up an application with Orbit-DB and IPFS. The idea is that different users will access the app either through the browser, through an Electron app (desktop), or through a node.js command line.

  1. For now, all nodes use WebRTC-star (electron and browser). It worked well until I tried moving the OrbitDB-IPFS part of the code to a webworker. Though JS-IPFS says that it works in a webworker, I could only get it to work by disabling WebRTC, at which point the application works very well but can’t find other peers anymore.
  2. On Electron, I am currently using IPFS in the renderer process. Is this considered “best practice” or should I try to move it to the main process? And if I do, what would be the best transports to use to ensure that each of browser, node and Electron versions of the app can all find each other?

Many thanks,
Julien Malard-Adam

1 Like