sdillard
2010-Oct-28 07:58 UTC
Looking for the best way to implement a tracking object for updates
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: 1. 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. 2. 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. 3. 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.