-
Notifications
You must be signed in to change notification settings - Fork 1.3k
locking between 2 browser tabs #1039
Comments
you could use cookies to do per domain locks
…On 16. Oct 2017, 10:33 +0200, Pedro Teixeira ***@***.***>, wrote:
• Version: latest
• Platform: browser
• Subsystem: repo
Type: question
Severity: Medium
Description:
In order to prevent opening the same IPFS node on two different browser tabs, I need to acquire some type of lock. By what I understand, locking in the browser is done in memory, preventing cross-tab access. Is there any way to solve this using js-ipfs?
Steps to reproduce the error:
Not applicable
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
My question was more if js-ipfs allows this somehow, and if it doesn't, does it plan to? (My opinion is that locking to ensure the same IFPS peerId is not shared between tabs should be a core feature.) |
Okay, then I am not sure what you are asking, ipfs-repo does locking so you can't reuse the same repo if both instances try to use the same indexddb entry. Are you asking for an exposed api to do locking in user land, or are suggesting js-ipfs should do more locking out of the box? |
I guess I'm asking several things:
Makes sense? |
@pgte is there a way to share an object across multiple tabs? That way js-ipfs would check if there is another node on start and just use that one. |
@diasdavid AFAIK, you can only pass messages (probably using localStorage), which means that some locking protocol would have to be built on top of this.. I think that the main problem to solve here is detecting that the lock owner tab is dead. This could be somehow accomplished by the owner putting a unique identifier in local storage that will enable other nodes to verify if the owner tab is alive or not. Another option is to have temporary locks (5 seconds, for instance), which have to be constantly renewed. Having said this, if two or more nodes boot up concurrently, there would need to be a way to guarantee that one and only of them wins, which I believe can only be accomplished with a consensus protocol.. I think we cannot escape this, but I may be wrong.. |
Let's have a session on this during the dev meetings. It is a big question in general, This is relevant for the Web Browsers work (@lidel), the GUI work (@olizilla), MFS (@achingbrain #1360), the DApps work (@pgte @satazor) and of course for all the js-ipfs users (@alanshaw @hugomrdias). @alanshaw, @achingbrain, @hugomrdias can I kindly ask you to propose a session around this topic for ipfs/developer-meetings? |
@Gozala can you have a look at this issue |
* fix: response for findpeer and findprovs Pick out the correct item from the response, do not assume the first is the one we want. License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai> * fix: allow CID instance to be passed License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai> * docs: add comments for magic Type numbers License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai> * fix: reinstate not found error License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai> * fix: module name * fix: add skip for dht.findprovs timeout test Go IPFS does not implement this option and the error that was being checked for was a false positive - it was an error to report no providers were found, which is not an error just a fact and this PR fixes this by removing that error and thus causing this test to now fail. License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide. If this is still an issue I would recommend opening an issue on the Helia repo. |
Type: question
Severity: Medium
Description:
In order to prevent opening the same IPFS node on two different browser tabs, I need to acquire some type of lock. By what I understand, locking in the browser is done in memory, preventing cross-tab access. Is there any way to solve this using js-ipfs?
Steps to reproduce the error:
Not applicable
The text was updated successfully, but these errors were encountered: