cthiel / cardboard

A simple web-based card grouping application with a bit of collaboration
https://github.com/cthiel/cardboard
Other
4 stars 0 forks source link

Update notification for multi-user edits #8

Closed garrett closed 13 years ago

garrett commented 13 years ago

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

In other words, we need polling and updating.

garrett commented 13 years ago

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.

cthiel commented 13 years ago

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.

cthiel commented 13 years ago

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.

garrett commented 13 years ago

Yup. That makes sense.

cthiel commented 13 years ago

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

garrett commented 13 years ago

Awesome.

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

cthiel commented 13 years ago

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

cthiel commented 13 years ago

Merged!