"Aldekein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I am writing a Perl program. The goal of it is to process streaming HTML site > (To describe - the document that you load never end - the new information is > added to the end and sent to the client connected, the connection is not closed > after this so it will be used more and more).
This usually isnt going to be possible because HTTP servers usually time out child servers that run after an amount of time. My mod_perl Apache server times out requests that run for 3 minutes. You can get your above idea to work but you will need a custom server. > Depends on new information received, it will write short information issues > constantly and post them somewhere, where interested people are. For example to > chat, using the post method. > > I don't know - what is better to use: LWP, Socket connection to the server, > Telnet etc. for processing the stream? Advices appreciated. > To follow your "chat" example, I would use perl to get the html to the browser, then I would have a repeating client side javascript function who's skeleton might look like this: function updateChatWindow() { var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.onreadystatechange = function() { doUpdateChatWindow( xmlDoc ) }; var pathStr = new String( window.location.pathname ); pathStr = pathStr.match(/.*\//); // populate qString with any request specific info you need to use on the server to get // the right data to the browser. The user's cookies will also be sent in the request if you // set one, so you will be able to do session managment and tracking. xmlDoc.load("http://" + window.location.host + pathStr + "chatMessages.cgi?" + qString); } function doUpdateChatWindow( xmlDoc ) { if ( xmlDoc.readyState == 4 ) { if ( xmlDoc.parseError.errorCode == 0 ) { // use the DOM object to get new data you want to display for the user, ergo this psudo-code: for dataNode in xmlDoc.getElementsByName("dataNode") { chatWindowObject.innerHTML = dataNode.value } } else { // error handling } } This requires a radical shift in development thinking, because you are using the browser as an application framework instead of a document viewer. To complicate matters further, Microsoft's DOM support is different than Netscape's. One needs to have a firm grasp of XML API's to understand how to implement this, but it definitely works in the latest netscape and IE browsers very, VERY well. It also looks alot nicer than the browser window making it's 'click' sound and clearing out and reloading the window every few seconds. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]