[Klone-users] Klone using server push

Andre Puschmann ap4lists at sp-ss.de
Tue Jul 8 13:32:11 EDT 2008


Hi all,

I am trying to use a server push technique to avoid client side polling
for data.
I am not sure if I am doing something wrong. For some reason Klone sends
all 4 "packets" in one single bunch. Well, at least wireshark reports this!
Seems like io_flush doesn't work?!

Here is my sample code:

<code>
<%!
   #include <stdio.h>
%><%
   int i;

   response_set_content_type(response,
"multipart/x-mixed-replace;boundary=---ThisRandomString---");
   response_set_field(response, "Pragma:", "no-cache");
   response_set_field(response, "Cache-Control", "no-cache, no-store,
must-revalidate");
   response_set_field(response, "Expires:", "Mon, 26 Jul 1997 05:00:00
GMT");


   io_printf(out, "---ThisRandomString---\n");

   for (i = 1; i < 5; i++)
   {
      io_printf(out, "Content-type: text/html\n\n");
      io_printf(out, "<h2>part %d</h2>\n", i);
      io_printf(out, "---ThisRandomString---\n");
      io_flush(out);
      sleep(1);
   }
%>
</code>

Using the built-in cgi works for a shell script. Also here's the code
for that one:

<code>
#!/bin/sh
echo "HTTP/1.0 200"
echo "Content-type:
multipart/x-mixed-replace;boundary=---ThisRandomString---"
echo ""
echo "---ThisRandomString---"
while true
do
echo "Content-type: text/html"
echo ""
echo "time: "
date
echo "---ThisRandomString---"
sleep 5
done
</code>


Comments are welcome!

Best regards,
Andre



More information about the Klone-users mailing list