public static function handleHeartBeat($cookie)
    {
        global $CFG;

        self::headerJson();

        session_start();
        $session_object = null;

        // TODO: Make sure to do the right thing with the session eventially

        // See how long since the last update of the activity time
        $now = time();
        $seconds = $now - LTIX::wrapped_session_get($session_object, 'LAST_ACTIVITY', $now);
        LTIX::wrapped_session_put($session_object, 'LAST_ACTIVITY', $now); // update last activity time stamp

        // Count the successive heartbeats without a request/response cycle
        $count = LTIX::wrapped_session_get($session_object, 'HEARTBEAT_COUNT', 0);
        $count++;
        LTIX::wrapped_session_put($session_object, 'HEARTBEAT_COUNT', $count);

        if ( $count > 10 && ( $count % 100 ) == 0 ) {
            error_log("Heartbeat.php ".session_id().' '.$count);
        }

        $retval = array("success" => true, "seconds" => $seconds,
                "now" => $now, "count" => $count, "cookie" => $cookie,
                "id" => session_id());
        $lti = LTIX::wrapped_session_get($session_object, 'lti');
        $retval['lti'] = is_array($lti) && U::get($lti, 'key_id');
        $retval['sessionlifetime'] = $CFG->sessionlifetime;
        return $retval;
    }