updating Web pages using xmlHttp

  • quote:


    Eugene S. Hertz

    I have several programmers who work for me who understand the code much better, but I do have a question for you.

    I am interested in making a streaming quotes application using html (dhtml or whatever)..

    Here's the idea..

    I have a html page (probably the result of asp) that lists a users *say* top 10 stocks he wants to watch. Hidden within the page is a small active X component.

    This component connects (http tunnel? socket? hmmm.) to my server. My server sends (say) XML messages to the client active x component (lets say the client active x has already "subscribed" to the 10 stocks by sending a list to the server). These messages coming from the server are quote changes/trade executions..

    Is it possible to then have the activex component update certain "static" fields on the web page? (when I say static, I mean that the fields are not "input boxes" but just text. Is this possible?

    I know of a company that does something like this called bangnetworks.com, I am trying to reverse engineer the process. do you have any thoughts?

    Would love to hear your opinion!


  • Yes it is very possible and not too difficult to do what you have proposed.

    A couple of notes:

    1. the active X component that your are refering to is called xmlHTTP. it is instantiated in jScript like this - var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    For examples on how to use this object see my article "CLIENT SIDE XML - ASP on steroids"

    2. The component communicates with the web server via Standard HTTP request packetts.

    3. Your client would have to send a XML stream requesting stats for certain stocks. then the Server-side page would process the request and build an XML response containing the stats for the stocks. Then the server would send the XML response back to the client.

    4. Static fields as you call them can be updated using the innerText or innerHTML property of the field. To do this you must wrap the text in a <DIV> tag and the div tag should have an ID like this <DIV ID="stock1">Static Field</DIV>. You can then replace the Static Field by doing this in JScript - document.all.stock1.innerText='New Static Field' Where 'New Static Field' is actually some text pulled out of the XML response.

    5. One of the hardest things about this solution is, How will you trigger the requests for updates. Will the user have to click a button "Refresh" or will you try to use a timer to automatically refresh every minute or five seconds? You will need to figure this out.

    FYI: this solution is a little outdated now that dotNet is released. The way most people would probably do this would be to create a Web Service that responds to stock requests. The Web Service would be called using SOAP protocol which is also a standard HTTP request.

  • We have an MSMQ infrastructure where each time a quote changes, a message is dropped onto the queue. In this way, we would use an mq listener function to listen to messages. Once a quote msg comes in, we would want to "push" it down to the client...Is this still possible with the xmlHTTP you have described here?

  • No sorry xmlHttp will not push information. All it does it make html requests to a web server. If your client had a web server running you could call a page on the web server.

  • Ultimately, we are looking for a push solution. To push streaming quotes out to web browsers...

  • Not sure if this will be of any help but can't hurt to check it out.

    http://msdn.microsoft.com/library/default.asp?url=/workshop/delivery/channel/overview/overview.asp

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply