couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [2/3] chttpd commit: updated refs/heads/1843-feature-bigcouch-clustered-eventsource-changes-feed to 17268d7
Date Tue, 27 May 2014 23:02:27 GMT
Send eventsource heartbeat event


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/b6882d1f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/b6882d1f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/b6882d1f

Branch: refs/heads/1843-feature-bigcouch-clustered-eventsource-changes-feed
Commit: b6882d1fa8fbc1eac1739f9ec92b77d5ae93259c
Parents: b743d75
Author: Russell Branca <chewbranca@apache.org>
Authored: Tue May 27 15:47:05 2014 -0700
Committer: Russell Branca <chewbranca@apache.org>
Committed: Tue May 27 16:02:01 2014 -0700

----------------------------------------------------------------------
 src/chttpd_db.erl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/b6882d1f/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 969da64..5c1c24d 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -106,7 +106,11 @@ changes_callback({change, {ChangeProp}=Change}, {"eventsource", Resp})
->
         "\n", "id: ", ?JSON_ENCODE(Seq),
         "\n\n"
     ],
-    {ok, Resp1} = chttpd:send_delayed_chunk(Resp, [Chunk]),
+    {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Chunk),
+    {ok, {"eventsource", Resp1}};
+changes_callback(timeout, {"eventsource", Resp}) ->
+    Chunk = "event: heartbeat\ndata: \n\n",
+    {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Chunk),
     {ok, {"eventsource", Resp1}};
 changes_callback({stop, _EndSeq}, {"eventsource", Resp}) ->
     chttpd:end_delayed_json_response(Resp);


Mime
View raw message