Monday, February 13, 2012

[Rails] best approach for ocean ship tracking or similar

Say you have a web page that is supposed to continuously update the
positions of ships in the ocean or something similar. I am wondering
what is a good approach for this ? The page updates automatically
without the user hitting any buttons or clicking on anything.

What occurs to me is a timer that goes off in JavaScript every couple
of seconds and sends a request to the Rails server. The Rails server
may send back a Javascript call or a series of calls with some data in
order to update the position of the ships. Basically the ships
positions are maintained on the server which gets live feeds of where
the ships are.

I have done similar types of things such as periodically_update() in
rails. Sometimes these polling type things get carried away and tons
of them get sent to the server. It could be that say there are 10
clients and each of them sends a request every couple of seconds so
now you have basically that many more requests and so on. Also if the
server gets behind on requests, the client keeps on sending them. For
whatever reason, it seems like a pain in the neck these types of
polling actions. They seem to clutter up the log file really bad and
possibly slow everything down in some situations. but I am not sure if
there is any other way to do this ?

If not is there a more optimal way to approach the polling I wonder ?

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate