W3C home > Mailing lists > Public > www-html@w3.org > May 2009

Method for server push via Never-ended documents (xhtml, xml, svg)...

From: Félix Hauri <felix@f-hauri.ch>
Date: Fri, 8 May 2009 12:05:36 +0200
To: www-html@w3.org
Cc: felix@f-hauri.ch, www-svg@w3.org
Message-ID: <20090508100536.GA17644@medium.hauri>
Hi,

I would like to present an idea of ``never-ended'' document,
following the notion of ``Progressive rendering''.
  http://www.w3.org/TR/2004/WD-SVG12-20041027/progressiverendering.html
( and of course, become some observations from your expertise ;)

There is a work about:
 - Remote monitoring via svg dynamiques files (even mixed in xhtml docs).
 - Minimise network traffic and server load,
 - Reducing network connections to maintaining only one.

My first approach was to use NPH-Server-Push in 
response to a regular XMLHttpRequest, in multipart mode.
  http://perso.f-hauri.ch/~felix/svg/cpu.svg

The ``traditional'' method (using XMLHttpRequest in javascrit loop)
(You could look the Sun over Bex(VS/Switzerland) at
  http://www.websolaire.ch/power.svg ;)
work fine but use more bandwidth because of sending HTTP headers
at each exchange, and more server load because of cgi fork at each
exchange.

My proposal is to send the xhtml *and* the pushed values
in the only one first connexion to server, as one xhtml
stream with the form:
<html>
 <head>
  <script type="text/javascript">
   ...
   function initvars(values) {
     ...
     stream_elm.removeChild(stream_elm.lastChild);
   }
   function do1job(values) {
     ...
     stream_elm.removeChild(stream_elm.lastChild);
   }
  </script>
 </head>
 <body>
 ...
  <div id="stream" style="display:none">
  <script language="javascript">initvars(1,2,3,4)</script>
--- cutted end of never-ended-xhtml stream ---

There is a prototype you can look (and download) at
  http://perso.f-hauri.ch/~felix/marcm/vmstat.cgi
The perl is not very well writen, and the javascript
could only be read in dumped stream, you could blame me,
but I'm alone and don't dispose as many time i need...
(I wanna clean them, isolate functions, export them as
 CGI object library, but this could take some time ago)

This demo script could work in standalone mode, on linux system:
 $ su - nobody
 $ cd /tmp
 $ wget http://perso.f-hauri.ch/~felix/marcm/vmstat.cgi/download/vmstat.pl
 $ chmod +x vmstat.pl
 $ ./vmstat.pl
 Server started at port 8881
You could look a dump with -x parameter:
 $ ./vmstat.pl -x
 Set-Cookie: delay=1; path=/; expires=dim, 07 jun 2009 11:17:26 CEST
 ...
 Content-Type: text/xml; charset=utf-8

 <!DOCTYPE html
 ...
 </p>
 <div id="stream" style="display:none">
 <script language="javascript">initvars(1035880,2007920,1)</script>

Firsts remark:
 - Idealy, the </body> must be present, but if so, the client
   (tested with mozilla and opera) will close network connexion.
 - Idealy, further request must be sent in following the first
   request, in the same network connexion, but there are
   limitation from clients.

In hope this could inspire your team to improve XHTML (and/or SVG)
specifications, and awaiting for your observations, please become
my thanks for your efforts to maintaining and make evoluate publics
standards.

--
 Félix Hauri - Informaticien consultant  |\      /|       ___  _
 --------------------------------------  | \ __ / |      /    -   /   o
 7, rue Centrale / CH-1450 Sainte-Croix  | .    . |     /_  ___  /
 Tél: (+41/0) 24 454 54 04  Fax:..54 00  |   /\   |    /   /__/ /   /  \/
 http://www.f-hauri.ch                   | \ __ / |   /   /__  /_  /_  /\
 email: felix@f-hauri.ch                  \ ____ /   ---------------------
Received on Friday, 8 May 2009 20:27:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:15 GMT