Send a real EventSource event for heartbeat#222
Closed
gdamjan wants to merge 1 commit intoapache:masterfrom
gdamjan:master
Closed
Send a real EventSource event for heartbeat#222gdamjan wants to merge 1 commit intoapache:masterfrom gdamjan:master
gdamjan wants to merge 1 commit intoapache:masterfrom
gdamjan:master
Conversation
Member
|
+1 |
Contributor
Author
|
I'm have doubts about the test, maybe it should check for heartbeat_count > 3 or something ? |
Member
|
@gdamjan with |
Contributor
Author
|
ok, thanks. |
Contributor
|
@gdamjan Aside from the typo it looks good overall. Would you mind fixing it so I can commit it? |
The EventSource connection can get stuck (in TCP half-open state*) and there's no way
for the client to detect that. This commit changes the way heartbeat is sent, instead of
sending a newline character, it sends an empty event of type heartbeat:
event: heartbeat
data:
This event doesn't have an id: field, so the client will retain its latest Last-Event-ID state.
This doesn't change the expectations of clients that used EventSource till now, because they
subscribe to the 'message' event type. To get the 'heartbeat' events a client will need to
explicitly subscribe to it:
source.addEventListener('heartbeat', function () { /* cancel a timer that would otherwise reconnect the source */ });
* this can happen when you suspend your laptop, on flaky internet connection, ADSL reconnect,
bad wifi signals, bad routers etc. Pretty often in a typical internet usage nowadays.
Contributor
Author
janl
pushed a commit
that referenced
this pull request
Jan 5, 2020
The link to couch_replicator_utils.erl is broken and should point to github code. In the new code, couch_replicator_utils.erl does not contains the ID generation logic so the reference is update to point to couch_replicator_ids.erl where de ID is build. Resolves apache/couchdb-documentation#221
nickva
pushed a commit
to nickva/couchdb
that referenced
this pull request
Sep 7, 2022
The link to couch_replicator_utils.erl is broken and should point to github code. In the new code, couch_replicator_utils.erl does not contains the ID generation logic so the reference is update to point to couch_replicator_ids.erl where de ID is build. Resolves apache/couchdb-documentation#221
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The EventSource connection can get stuck (in TCP half-open state*) and there's no way
for the client to detect that. This commit changes the way heartbeat is sent, instead of
sending a newline character, it sends an empty event of type heartbeat:
This event doesn't have an id: field, so the client will retain its latest Last-Event-ID state.
This doesn't change the expectations of clients that used EventSource till now, because they
subscribe to the 'message' event type. To get the 'heartbeat' events a client will need to
explicitly subscribe to it:
bad wifi signals, bad routers etc. Pretty often in a typical internet usage nowadays.