As far as I've been able to find out since you posted your OP, there is no real standard for doing all this. I guess you should be able to just flush the output buffer whenever you have a chunk of data ready and let the client-side code figure out how to break up the stream in ready chunks.

I do know that relying on multi-part bodies alone (without client-side code) does not work as well as you'd hope, and I suspect using multi-part bodies will be slightly more work to interpret by your ajax code (if they work at all) than a custom (simpler) format.

update: if you want to do this seriously (i.e. multiple events, many clients) with perl, you probably need a special light-weight server for the event streams, if only because having a few hundred apache processes will eat your memory.


In reply to Re^3: Perl modules for Comet ? by Joost
in thread Perl modules for Comet ? by renodino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.