now() function returns a function #52

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


None yet

2 participants


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 || new Date().valueOf;

returns a function in case 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
@jmesnil jmesnil closed this in d42f7e8 Mar 4, 2014
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