couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject feed=continuous and newline
Date Thu, 06 Aug 2009 14:17:41 GMT
Raising a minor point here for discussion, rather than on JIRA.

With feed=continuous, the newline after the last record isn't sent until the
*next* record is available. For example:

$ telnet localhost 5984
Connected to localhost.
Escape character is '^]'.
GET /test/_changes?feed=continuous HTTP/1.0
Host: localhost

HTTP/1.0 200 OK
Server: CouchDB/0.10.0a (Erlang OTP/R12B)
Date: Thu, 06 Aug 2009 14:11:26 GMT
Content-Type: text/plain;charset=utf-8
Cache-Control: must-revalidate

                  stops at end of line

When the next record is generated, it adds <comma> <newline> <record>.

Whilst this makes the feed pretty to read, it doesn't make it easy to parse,
as you basically need a full JSON stream parser to delimit the record. Or
else, you're always one record behind.

Wouldn't it be better to send the record followed by a newline, and then
<comma> <record> <newline> for the next one? That is,




View raw message