node-analytics.js
function sessionSave(session, request, cb){

    const now = new Date();

    if(!session.continued){

        session.reqs = [request];

        Update.session(
            session,
            {  $set: session  },
        (err, session) => {
            if(err)
                return cb('db session save error');

            if(opts.log_all)
                log.session(session, 'session active [ new ]');

            cb(null, session);

            if(opts.log_all)
                log.timer('sessionSave 1', now);
        })
    }
    else {
        // an old session: all that needs be updated is request
        Update.session(
            session,
            {  $push: { reqs: request }  },
        (err, session) => {
            if(err){
                log.error('db session update error');
                return cb(true);
            }

            if(opts.log_all)
                log.session(session, 'session active [ updated ]');

            cb(null, session);

            if(opts.log_all)
                log.timer('sessionSave 2', now);
        });
    }
}
function sessionSave(session, request, cb){

    const now = new Date();

    if(!session.continued){

        session.reqs = [request];

        Update.session(
            session,
            {  $set: session  },
        (err, session) => {
            if(err)
                return cb('db session save error');

            if(opts.log_all)
                log.session(session, 'session active [ new ]');

            cb(null, session);

            if(opts.log_all)
                log.timer('sessionSave 1', now);
        })
    }
    else {
        // an old session: all that needs be updated is request
        Update.session(
            session,
            {  $push: { reqs: request }  },
        (err, session) => {
            if(err){
                log.error('db session update error');
                return cb(true);
            }

            if(opts.log_all)
                log.session(session, 'session active [ updated ]');

            cb(null, session);

            if(opts.log_all)
                log.timer('sessionSave 2', now);
        });
    }
}
save / update session to DB & proceed to socket