-
Notifications
You must be signed in to change notification settings - Fork 11
Exposing API instance when embedded via iframe #30
Comments
https://github.com/ipfs/developer-meetings/blob/master/sessions/deep-dive/service-worker.md Berlin dev meetings we did a deep dive, would love to prototype this with anyone interested. |
We discussed this in Berlin and we got some nice conclusions The main problem that I remember is having the same repo shared for different web apps, allowing them to get data from each other. I discussed this with someone after the presentation |
I just want to point out there is also some interesting and not very obvious opportunity with this:
|
Hi @vasco-santos could you provide little more details on this ? I think allowing data to be shared is useful no ? But restrictions on what is and isn't shared is important indeed & I think that should be part of the node's responsibility to manage. When embedded requests an API |
Hey @Gozala you just provided all the details 😀 We ended up not having time to discuss how we would tackle those restrictions, and it is still an open problem that we need to think. So, that is the point that we need to revisit for going with this new step. Thanks for your suggestion, I feel it may be a good direction. |
@hugomrdias ah, thank you for the link! I remember I proposed that session but missed it due to scheduling conflict 😞 I had some initial success with (note that iframe has different Origin due to port number) I will post updates later this week, need to do some additional tests and cleanup first, but so far looks really promising. |
just posting this link here ipfs/in-web-browsers#137 due to relevancy |
Background
I remember having a brief discussion about this workaround with someone in the past but I think we were hoping foreign fetch will land, so it never went anywhere. Now that foreign fetch got removed from ServiceWorker spec we should revisit and look into this once again.
Summary
So the idea is we could avoid having multiple instances of js-ipfs being spawned by ipfs-service-workers running on multiple pages by exposing API of a single service-worker-gateway's instance (eg. js.ipfs.io) over iframe's postMessage+ipfs-postmsg-proxy making all those SW instances talk to that one js-ipfs instance instead of spawning their own.
Example
Additional context extracted from arewedistributedyet/arewedistributedyet#32 (comment):
Prior Discussions
@daviddias @vasco-santos I think this was discussed before, do you remember if there were any technical blockers or open problems that made this not feasible? Or is it ok to look into this?The text was updated successfully, but these errors were encountered: