now() function returns a function #52

Closed
chabou-san opened this Issue Mar 3, 2014 · 1 comment

Projects

None yet

2 participants

@chabou-san

Hi jsmenil,

I'm setting up the heart-beat functionality in my js app. I realized, while checking whether the "PONG" part was working as expected, that the function "now" currently implemented as :

now = function() {
  return Date.now || new Date().valueOf;
};

returns a function in case Date.now is defined in the browser. As I'm using Chrome 33.0.1750.117, the function is actually defined.
But when it is used, you expect that the function returns a number instead of being a function.
As a consequence, when the delta between now() and _this.serverActivity is set (L.189 of the stomp.js compiled file), instead of being a number, it is set to NaN. Thus, the comparison to the ttl * 2 fails, and the websocket never closes.

@jmesnil jmesnil added a commit that closed this issue Mar 4, 2014
@jmesnil fix now() function
fixes #52 by making now() return a value and not a function
d42f7e8
@jmesnil jmesnil closed this in d42f7e8 Mar 4, 2014
@jmesnil
Owner
jmesnil commented Mar 4, 2014

I've fixed this issue. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment