Closed garrett closed 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.
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.
Great stuff! I tried it locally and it worked nicely :)
Merged!
...or for when one person edits and another is viewing.
In other words, we need polling and updating.