Live data from Hacker News

A simple way to build collaborative web apps

zjy.cloud

1–10 of 73 posts

Re: A simple way to build collaborative web apps

#3
post #2

What about conflict resolution? If two users update the same record/field around the same time? Isn’t that the trickiest part of real time?

That's what Replicache[0] solves, it provides for Causal+ Consistency across the entire system.

"This means that transactions are guaranteed to be applied atomically, in the same order, across all clients. Further, all clients will see an order of transactions that is compatible with causal history. Basically: all clients will end up seeing the same thing, and you're not going to have any weirdly reordered or dropped messages."

[0] https://doc.replicache.dev/design

Note: There's more in their links, but the linked sites are down..

Re: A simple way to build collaborative web apps

#5
post #2

What about conflict resolution? If two users update the same record/field around the same time? Isn’t that the trickiest part of real time?

Figma's blog has a few valuable articles on that subject: https://www.figma.com/blog/how-figmas-multiplayer-technology...

Re: A simple way to build collaborative web apps

#8
We implemented all that manually, more or less in swift (and sqlite), then react+redux, and on the back end - postgres and python+flask. Works flawlessly so far. We do have the same setup more or less, with listeners triggering UI updates and push messages signalling the clients to fetch data from the server. Then, on the server, we have two dbs -> one where we store each update or create message, in a postgres-based queue, and another one, in a normalised format which we use for login (it's way faster than replaying all messages from the queue). There are complexities when you move beyond one or two tables, though - like maintaining relations, ensuring things get done in the correct order, that they get merged (we merge all attributes of each item - e.g. one client can change color, and the if another changes the text content of the item these will get merged), etc.

We gave up on the websocket part and implemented basic polling, because they were not supported by App Engine at the time (things might have moved on since then, which is a couple of years ago). Yet, for a note/todo/habit tracking app, it simply doesn't need to be real-time from our experience.

Have a play at https://www.mindpad.io/app/. You can see how it works if you open up the web app in two incognito tabs, or on an iPhone and the web.

Post reply on HN