I am developing an app in Cappuccino that uses Rails as the backend.
The problem that I am concerned about is that I need some way to know
whether the data on the client requires updating without having to
constantly requery to get new items. It’s not a ton of data, and I
double-check that a record exists before doing any operations on it,
but I show a table view. In the case where an item is added by
another user, I need to update the table to reflect that. Here are
the ways I considered:
- Have a timer in the javascript that submits the ids being viewed to
the server and have the server return a flag for whether any of them
changed or if there are new ones or deleted ones, which would cause a
re-get on the client. - Maintain a table with a single object that is used to track the
number of adds, deletes, and updates that have been performed for the
two types of models that I am concerned about. If that number
changes, then the UI would do a further check. The concern here is
how to maintain such a table without locking, since I can’t really use
the counter cache. - Have a timer in the javascript that re-gets the data one a periodic
basis, but that seems like way too much overhead and traffic over the
wire.
I’m really not sure what things like GMail or Mockflow do for this,
but those are good examples of the type of client/server interaction I
am dealing with. Clearly, what would be most desirable is something
like comet where the server pushes the data down to the UI, but I am
not sure that is feasible.
Any thoughts or suggestions? Thanks in advance