Live data from Hacker News

Show HN: RemoteStorage – sync localStorage across devices and browsers

github.com

61–69 of 69 posts

Re: Show HN: RemoteStorage – sync localStorage across devices and browsers

#61
post #42

Earlier quoted context omitted.

This is handled by Redis, as such, the last write will win. As the primary key is tied to the user id, there will not really be a concept of Machine A vs Machine B as the end user can only be in one place at a time.

I see. The case in question is when the user switches between two devices, each of which may be sometimes offline. This can cause older changes hitting the server later than the new ones, in which case, ideally, they should be rejected. What happens to storage requests made while offline? Are they cached locally and propagated once online, or are they lost?

I feel like, if the answers to these questions are important, you should be using a more complex solution.

Re: Show HN: RemoteStorage – sync localStorage across devices and browsers

#62
post #36

How are the conflicts resolved? Machine A is online and sets "x" to 1. Machine B is offline and sets "x" to 2. Machine B goes online. What the resulting state on A and on B? What if initially A was offline and B was online?

Based on the comments I think this is just, not yet implemented. But is one of the next steps for truly cross device storage.

Re: Show HN: RemoteStorage – sync localStorage across devices and browsers

#67
post #59
post #48

The use case is limited, a project has it's own backend, why need to add a new sub-system for tiny data storage?

I would state the opposite, the use case is huge. To add something new, that needs to persist, will not require going to a backend team and begging for a new API from them. A common difficulty is the simplest scenario, where do I store this frontend user preference? How do I store this that prevents nagging multiple times across devices? Backend teams will argue this is a frontend piece of data, and they provide APIs…

This sounds like something that should just be an extra JSON column in the users table of any SQL database. Backend team shouldn't be withholding backend support if remembering this data is actually important.

Re: Show HN: RemoteStorage – sync localStorage across devices and browsers

#69

On the authentication front - JWTs would be a great fit here! The developer's backend could issue a JWT, which is validated by the remoteStorage backend. Then, use the `sub` field as the user ID. JWTs are pretty ubiquitous in frontend applications, so many people would be able to reuse their existing auth setup.

And JWTs are live! Thanks for the suggestion. https://github.com/FrigadeHQ/remote-storage/releases/tag/rem...
Post reply on HN