Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node reuse and resource sharing on the web #158

Open
lidel opened this issue Mar 16, 2020 · 4 comments
Open

Node reuse and resource sharing on the web #158

lidel opened this issue Mar 16, 2020 · 4 comments
Labels

Comments

@lidel
Copy link
Member

lidel commented Mar 16, 2020

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:

  • datastore uses local storage allocated to the origin,
    this means permissions and storage limits are shared with other JS running on a page
  • opening a new tab for the same page spawns a new, full instance of js-ipfs operating on the same datastore

Cross Origin

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

  • new datastore is created per Origin
    • nodes are unable to share storage,
      • data for a single CID can be stored multiple times in the same browser profile

Same machine

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

  • delegated routing
  • content preload
  • circuit switching (relay)
  • shared cache, data deduplication
  • persistence (ensuring CIDs are cached outside non-persistent browser storage)

References

Prior Art

@dokterbob
Copy link

dokterbob commented Jul 28, 2022

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?

ipfs-search/dweb-search-frontend#150

@lidel
Copy link
Member Author

lidel commented Aug 5, 2022

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:

  • delegated routing
  • trustless retrieval
    • you no longer need to run full js-ipfs to fetch CID data and verify hashes.
    • trustless gateways allow you to fetch raw block or a bag of blocks and deserialize them into files see tools like ipfs-car for code examples.
  • WebTransport
    • it solves the problem of WebSockets requiring TLS cert, which is limiting the connectivity options on the web (js-ipfs running on a web page can't dial TCP and QUIC peers)
    • wip spec in https://github.com/libp2p/specs/pull/404/files – see /certhash section to understand why this is a big deal for us

@RangerMauve
Copy link

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
Copy link

Gozala commented Aug 15, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants