[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: If you want "Fat Pings" just use Atom!
A. Pagaltzis wrote:
> * Bob Wyman <bobwyman@xxxxxxxxxx> [2005-08-22 01:05]:
>>What do you think? Is there any conceptual problem with
>>streaming basic Atom over TCP/IP, HTTP continuous sessions
>>(probably using chunked content) etc.?
> I wonder how you would make sure that the document is
> well-formed. Since the stream never actually ends and there is no
> way for a client to signal an intent to close the connection, the
> <feed> at the top would never actually be accompanied by a
> </feed> at the bottom.
> If you accept that the stream can never be a complete well-formed
> document, is there any reason not to simply send a stream of
> concatenated Atom Entry Documents?
> That would seem like the absolute simplest solution.
I think the keyword in the above is "complete".
SAX is a popular API for dealing with streaming XML (and there are a
number of "pull parsing" APIs too). It makes individual elements
available to your application as they are read. If at any point, the
SAX parser determines that your feed is not well formed, it throws an
error at that point.
With a HTTP client library and SAX, the "absolute simplest solution" is
what Bob is describing: a single document that never completes.
Note that if your application were to discard all the data it receives
before it encouters the first entry, the stream from there on out would
- Sam Ruby