"streaming" via server push?
Status: Alpha
Brought to you by:
borud
I can't write C, but the concept is simple:
if (conf->format == "stream") {
#define BORDER "thisisamultipartborder";
print "Content-type: multipart/x-mixed-replace;
boundary=\"BORDER\"";
print "\r\n--BORDER\r\n";
while (1) {
grab_new_image();
print "Content-Type: image/jpeg\r\n";
printf "Content-Length: %d\r\b",
sizeofjpeg(grabbed_image));
print "\r\n";
print grabbed_image;
print "\r\n--BORDER\r\n";
sleep(conf->sleep);
}
}
of course, apache probably has special directives for
print()ing out to the client, and the while(1) would
probably blow up apache, you should get the general idea.