     @ws.on "open", =>
       @robot.logger.info "Opened"
       @connected = true
-      @lastMessageSeen = Date.now()
+      @lastMessageSeen = Date.now
       @heartbeatTimeout = setInterval =>
         if not @connected then return
-        if Date.now() - @lastMessageSeen > 30000
-          @robot.logger.error "Heartbeat too old at %ds", (Date.now() - @lastMessageSeen) / 1000
-          @reconnect()
+        if Date.now - @lastMessageSeen > 30000
+          @robot.logger.error "Heartbeat too old at %ds", (Date.now - @lastMessageSeen) / 1000
+          @reconnect
         else
           @ws.send JSON.stringify({"type": "heartbeat"})
           @robot.logger.info "Sent heartbeat"

      @emit "connected" unless @alreadyConnected
      @alreadyConnected = true
    @ws.on "message", (data, flags) =>
      @websocketMessage JSON.parse(data)
    @ws.on "error", (error) =>
      @robot.logger.error error
      @reconnect()
    @ws.on "close", =>
      @robot.logger.info "Closed"
      @reconnect()
    @ws.on "ping", (data, flags) =>
      @ws.pong


      when "error"
        @robot.logger.error packet.message
      when "message"
        if -1 != @robot.name.indexOf packet.user.id
          return
        user = @robot.brain.userForId packet.user.id, name: @quipMention packet.user.id, room: packet.thread.id
        text = packet.message.text
        if @selfMention == text.substr 0, @selfMention.length
          text = @robot.name + text.substr @selfMention.length
