const authHandler = require('./auth-handler'),
sessionHandler = require('./session-handler');

function connectionHandler(client, clientInfo){
	let user = {};
	user.keys = [];

	client.on('authentication', (context) => {
		authHandler(context, clientInfo);
	});

	client.on('ready', () =>{
		client.once('session', sessionHandler);
	});

	client.on('end', function(){
		console.log("Client disconnected");
	});

	client.on('error', function(err){
		// what's an error?
	});

}

module.exports = connectionHandler;

const authHandler = require('./auth-handler'),
      sessionHandler = require('./session-handler');

function connectionHandler(client, clientInfo){
	let user = {};
	user.keys = [];

	client.on('authentication', (context) => {
		authHandler(context, clientInfo, user);
	});

	client.on('ready', () => {
		client.once('session', (accept, reject) => {
            sessionHandler(accept, reject, user);
        });
	});

	client.on('end', () => {
		console.log("Client disconnected");
	});

	client.on('error', () => {
		// what's an error?
	});

}

module.exports = connectionHandler;

Call handlers with user param
Call handlers with user param

in addition, clean up a few things
