The moose likes HTML, CSS and JavaScript and the fly likes Does CNN Money use pull or push to get the market updates? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Does CNN Money use pull or push to get the market updates?" Watch "Does CNN Money use pull or push to get the market updates?" New topic
Author

Does CNN Money use pull or push to get the market updates?

Jane Somerfield
Ranch Hand

Joined: Jul 20, 2002
Posts: 192
You can see the market change in every 2 seconds on money.cnn.com. It looks like the client pulls the data from the server. Is this correct?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

What did you find when you looked at the source code?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jane Somerfield
Ranch Hand

Joined: Jul 20, 2002
Posts: 192
I cannot tell. Can you?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

I haven't looked. My bet is a pull as push technology is pretty resource-expensive.
Jane Somerfield
Ranch Hand

Joined: Jul 20, 2002
Posts: 192
I did a simple experiment:

While CNN Money showing the changing market data, I disconnected the network connection from my computer.
The last data remains on the page (values, timestamp, ...) without any changes during the period of disconnection.
The disconnection time is about a hour. Then I connected the computer to the internet, and saw the updates resumed in about 5 minutes after the connection.

I do not think CNN Money server keeps the connection information (or client session) after the connection are gone for over a hour. So server pushing in this
situation is impossible.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
The code is in the numbered JavaScript file. It is an interval polling the server, it is basic Ajax, looks to have an iframe fallback if I am reading the code correctly. I just glanced at it.


Basic idea is make a call to the server after a set period of time looking for new data. If he call errors out, probably disconnected and change the polling time to a larger time difference. When you get new data, you just update the page.


Eric
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

[I knew Eric wouldn't be able to resist poking at the code. ]
 
 
subject: Does CNN Money use pull or push to get the market updates?
 
Threads others viewed
Working on Financial domain
WA #1.....word association
Should prostitution be legal?
Current Job Market
IT job market
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture