Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: correctly differentiate pong responses
Browse files Browse the repository at this point in the history
Investigation discovered that pong responses CAN have `time: 0` (they can be very quick). Previously pong messages were differentiated by time greater than 0, but considering it can be 0 this was incorrect.

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
alanshaw committed May 24, 2018
1 parent 7ee17ba commit 4ad25a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/ping.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const f = require('./utils/factory')

// Determine if a ping response object is a pong, or something else, like a status message
function isPong (pingResponse) {
return Boolean(pingResponse && pingResponse.time)
return Boolean(pingResponse && pingResponse.success && !pingResponse.text)
}

describe('.ping', function () {
Expand Down

0 comments on commit 4ad25a3

Please sign in to comment.