-
Notifications
You must be signed in to change notification settings - Fork 30
Using IPFS with electron (or muon) #256
Comments
Quick update! For everyone looking to use go-ipfs in Windows with Electron, @thisconnect has shipped compatibility in js-ipfsd-ctl. See:
|
Update here, @hacdias just refreshed IPFS Station with bug fixes, features, and all new look! Check out https://github.com/ipfs-shipyard/station to see an IPFS Application with electron. |
Update: 3) is now supported as well with js-ipfs 0.29 and Electron 2.0. See example here https://github.com/ipfs/js-ipfs/tree/master/examples/run-in-electron |
As we are developing https://gitlab.com/siderus/orion/ui around Where does the implementation stand when compared to |
I am also developing an electron app using js-ipfs inside the main electron process in "electron": "^1.8.6". It works on Linux, need to check on Mac and Windows. I was wondering which one is better, js-ipfs or ipfs-connector ? I have the same question which @koalalorenzo is asking
|
@vaibhav6233m I’m not super familiar with
I’d say js-ipfs is still a bit behind if you’re looking for full functionality. For example, the pin API and MFS aren’t done yet. (But both are really close!) If you don’t need those, you probably want to pay close attention to these issues on making |
@Mr0grog Thanks a lot for your comments. In my case, I wanted to use the In the IPFS documentation this is mentioned.
But I could only find the references to I tried to use those also but still facing some issues. I am not sure if it is the proper way to access them. Is it the same while using the |
Yeah, it would be great if you moved this to https://discuss.ipfs.io.
First, can you accomplish what you want with pubsub instead of libp2p? If yes, you can use that through any of the libraries. Otherwise, libp2p usage over the API can be complicated.
Again, if you want to ask more about those, you should probably move this to https://discuss.ipfs.io. |
@Mr0grog Thanks a lot again. I'll be posting the technical issues to https://discuss.ipfs.io/ . |
We now support Electron v5.0.0 without the need to rebuilt native modules. We will also be adding electron main and renderer to the test targets, support is already in aegir. |
It was raised to my attention that there have been some questions on the state of IPFS in Electron. I thought I would compile my notes and the information I shared in the last IPFS All Hands as it might be used by several members of the community.
If you are new to Electron or Muon, they are both open source frameworks that enable you to create native desktop applications that are independent of the OS (as long as it is Linux, Windows or Mac) while using the familiar Web technologies that you know and love. Electron was the first and Muon is a fork designed to specially build browsers.
Both of these frameworks offer to contexts, the:
Both of these processes are connected by an IPC channel (ipcMain and ipcRenderer) so that you can send messages back and forth.
Given all of this, what are the options today? They are:
3) Using js-ipfs from the Main processCurrently, it does not work and that is what the thread The road to Electron support covers.1) Using a go-ipfs daemon with js-ipfs-api from the Main process
Spawning a go-ipfs daemon from Node.js is quite easy today by using the
ipfsd-ctl
. This module lets you export two API, one to directly control the daemon, another to control the daemon usingjs-ipfs-api
.We use this mode on Station, the IPFS menu bar application. You can also learn how we spawn the node and interact with it on the init.js file.
2) Using a go-ipfs daemon with js-ipfs-api from the Renderer process
Very similar to the mode above, you can spawn a go-ipfs deamon through the Main process and then create a js-ipfs-api on the Renderer process to make requests to it.
Having to create the instance separately could feel a bit cumbersome, fortunately, there is a better way! Electron supports a way to call Main process modules or instances directly from the Renderer process by automatically creating an RPC for them using the Remote API. You are able to create the same instance as 1) and then pass a reference to the Renderer process without having to actually do instantiation on the Renderer process.
This is how orbit-electron has been working since the beginning https://github.com/orbitdb/orbit-electron
3) Using js-ipfs from the Main process
Currently, it does not work and that is what the thread The road to Electron support covers.The reason why is due to the use of some Native dependencies in js-ipfs that do not get compiled cleanly by Electron's own Node.js version. We already started the process of fixing or replacing some of this dependencies but more work needs to be done. If you would like to help, make sure to check The road to Electron support.Update: With js-ipfs 0.29 and Electron 2.0, you can now run js-ipfs on the Main Process too! See an example here https://github.com/ipfs/js-ipfs/tree/master/examples/run-in-electron.
4) Using js-ipfs from the Renderer process
You can use js-ipfs from the Renderer process. The simplest way is to just grab the dist version of
js-ipfs
and add it as a script to your Electron app, it will expose aIpfs
class for the context of your app just like loading IPFS through a Script tag.This is own we approached the IPFS integration for the Brave browser as you can see in the prototype ipfs-inactive/browser-laptop#1
The text was updated successfully, but these errors were encountered: