cthiel / cardboard

A simple web-based card grouping application with a bit of collaboration

Home Page:https://github.com/cthiel/cardboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update notification for multi-user edits

garrett opened this issue · comments

...or for when one person edits and another is viewing.

In other words, we need polling and updating.

I suppose we could poll the server every so often and ask for the latest state, in JSON and notify if it has changed (and then ask the user if they want to update to the latest version).

If nothing has changed on the client side (but there have been changes on the server), then automatically update.

If the state is dirty (as if the user declined the updated changes), we'd have to ask if they would want to overwrite the data on the server.

I added /stories/last_changed.json for now, which returns a json object with the timestamp of the last changed story. Do you need more from the backend to check this in JS?

We could as well look into websockets, but that would probably be overkill for now.

Maybe using HTTP 304 (not modified) would also be an option? I could easily set that for the stories.json. Let's discuss this tomorrow.

Yup. That makes sense.

It now has http 304 based caching for the /stories.json and /status.json. So we can easily pull for changes in the JS?

Awesome.

Check out the collab branch and play around with two windows open.

  • The update tick is roughly every 5 (or so) seconds
  • It pauses the updates when the mouse is moved or a dialog is open (this is intentional)
  • It does not update the color CSS file (yet) — so if you modify colors, it won't do a live update
  • We need more dialogs, to prevent users from overwriting data
  • Currently, it always overwrites your settings with what the server says. (I need to add a basic dirty lock.)
  • We need more dialogs, to prevent users from overwriting data
  • It's a lot of fun to play with, as it makes a fun demo w/ two browser windows open

Great stuff! I tried it locally and it worked nicely :)

Merged!