Google Answers Logo
View Question
 
Q: What is the cost of learning how to stream data to javascript browsers? ( No Answer,   6 Comments )
Question  
Subject: What is the cost of learning how to stream data to javascript browsers?
Category: Computers > Programming
Asked by: alexjacobson-ga
List Price: $4.00
Posted: 12 Apr 2005 17:25 PDT
Expires: 12 May 2005 17:25 PDT
Question ID: 508567
How should I price an answer to this question?

How do I implement a browser based stock market ticker that 
* relies only on client side javascript (not flash or java)
* does not require polling
* does not look like the browser is always downloading
* works in all major browsers (mozilla, ie, safari)?
Answer  
There is no answer at this time.

Comments  
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: joepossible-ga on 12 Apr 2005 17:30 PDT
 
I imagine it would take some extensive knowledge of programming and
java.  I know a little bit, but it would require some research on my
part.  However, if you do find your answer I'd like to know as well
=).  I suggest puting it at least higher then $15 for now.
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: willcodeforfood-ga on 12 Apr 2005 22:31 PDT
 
JavaScript alone won't accomplish what you're after.  To push data to
a browser (initiated by a server) requires that the client application
keep a socket connection with the server open.  Browsers, by design,
don't do this.  Flash, Java and ActiveX controls can do this, but
JavaScript will not.  Since JavaScript cannot maintain an open socket
connection with a server, the workaround is to poll the server but
you're excluding that option.  Even if you decide to use Flash, Java
or ActiveX you'll still have the difficulty of making it work on all
of the major browsers.  So where can your requirements bend?
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: webadept-ga on 13 Apr 2005 00:58 PDT
 
Q. " What is the cost of learning how to stream data to javascript browsers? "
A. "Your sanity." 

You can do it, by cycling through an XML file which is changed by an
external method (cron job or RSS feed or some sort). Getting all the
browswers to do this is going to cost some sleepless nights, but it is
possible.

webadept-ga
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: alexjacobson-ga on 13 Apr 2005 08:49 PDT
 
I know you can do it in javascript in mozilla and ie.  Except that ie
looks like it is still downloading....
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: willcodeforfood-ga on 13 Apr 2005 09:38 PDT
 
Cycling througn an XML file would still be polling.  If you trick the
browser into thinking it's receiving one big huge continuous XML file,
you are just constantly polling.  That's why IE will look like it's
downloading.  Data push initiated by server to browser cannot be done
in JavaScript.  Don't mean to split hairs, but just wanted to be clear
that there is no solution here that meets all of the requirements.
Subject: Re: What is the cost of learning how to stream data to javascript browsers?
From: pianoboy77-ga on 14 Apr 2005 12:05 PDT
 
The most common way to accomplish what you want is to use XMLHttpRequest. 
Here's a good article with an example application:

http://developer.apple.com/internet/webcontent/xmlhttpreq.html

In fact, this is the approach used by Google Suggest and Google Maps
to dynamically retrieve data on the fly without you even knowing it:
://www.google.com/webhp?complete=1&hl=en
http://maps.google.com

Using XMLHttpRequest, the browser won't appear to be downloading
(unless you're downloading images, like seen with Google Maps, but
even with this you won't see the download "bar") and it is supported
on all 3 browsers you listed. Technically, you'd still be polling for
data. Also, on Windows/IE, you're actually creating an instance of an
ActiveX component in your javascript code, so this also does not meet
your requirement. However, using XmlHttpRequest is become so common
(especially thanks to Google maps & Google Suggest), I wouldn't
hesitate to use this approach.

Note that for different browsers you need to create the XMLHttpRequest
object differently. You can see Google Suggest doing this in its
source, trying a couple different ways to create the object.
( www.google.com/ac.js  -- Open in Notepad and search for "xml" )

As willcodeforfood-ga pointed out, there's no solution that completely
satisfies all of your criteria, but I hope that this may point you to
a solution with compromises which may work for you.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy