ipfs / in-web-browsers

Tracking the endeavor towards getting web browsers to natively support IPFS and content-addressing
https://docs.ipfs.tech/how-to/address-ipfs-on-web/
MIT License
349 stars 29 forks source link

Node reuse and resource sharing on the web #158

Open lidel opened 4 years ago

lidel commented 4 years ago

This is a placeholder for tracking open problems and related issues / notes

Embedding js-ipfs on a page binds it to specific tab, origin, and storage.

Open problems

Per Origin

js-ipfs embedded on a web page runs in the context of page's Origin, which means:

Cross Origin

Each websites running js-ipfs does it on its own:

Same machine

js-ipfs is unable to discover ipfs-desktop running on the same machine. It could leverage its existence for:

References

Prior Art

dokterbob commented 2 years ago

Hi @lidel, others, this issue has been a big blocker in terms of usability for us to run js nodes client-side on ipfs-search.com

Is any work on this being done? Is this on the roadmap at all?

https://github.com/ipfs-search/dweb-search-frontend/issues/150

lidel commented 2 years ago

There are some recent developments which make it easier to work with content-addressed data, often removing the need for running full js-ipfs, or hardcoding some WebSockets providers, preload nodes for performing bitswap:

RangerMauve commented 2 years ago

Is using SharedWorkers under the hood an option? It think one limiation there is that stuff like WebRTC wouldn't be able to run within the worker.

Gozala commented 2 years ago

Is using SharedWorkers under the hood an option? It think one limiation there is that stuff like WebRTC wouldn't be able to run within the worker.

That is accurate. Thinking around there had been that we could implement custom transport that would leverage WebRTC in the host frames (select arbitrary host and ask it to proxy messages, if host times out select next host etc...).

It is also worth calling out that SharedWorker was deliberately not implemented by Safari, however I've done some experiments simulating SharedWorker API with ServiceWorker instead.