electric icon indicating copy to clipboard operation
electric copied to clipboard

What does "Multiplayer-native" mean in the readme?

Open oscarhermoso opened this issue 2 years ago • 1 comments

Might need a clarifiaction, I tried googling and couldn't find anything

Thanks 🙂

oscarhermoso avatar Feb 15 '23 08:02 oscarhermoso

Hi @oscarhermoso, thanks for the question!

It means the app you build will automatically sync between concurrent users. You can see this when running the starter app, just open 2 tabs and anything you write in one tab will automatically show up in the other.

What do you think we could add to the readme to clarify this to the users?

xificurC avatar Feb 15 '23 08:02 xificurC

In the TodoMVC demo, code-wise it's just a regular old TodoMVC but if you run in two tabs it stays in sync

dustingetz avatar Feb 15 '23 20:02 dustingetz

What happens on conflicts? How does it compare to CRDT's?

bbss avatar Feb 21 '23 12:02 bbss

Transactional vs conflict-free is a userland choice; streaming a mouse coordinate signal, for example, is not transactional. If userland wants to write to a shared reference, you'll need to provide a conflict resolution strategy, many libraries to choose from. The default choice of "atom with reset!" encodes a race, "atom with swap!" is perhaps the simplest possible transaction.

dustingetz avatar Feb 21 '23 16:02 dustingetz

Take the demo-chat for example - if two users send a message at the same time, the atom serializes the events and they race. https://github.com/hyperfiddle/electric/blob/master/src-docs/user/demo_4_chat.cljc#L27

dustingetz avatar Feb 21 '23 16:02 dustingetz