export function runBlock($log, $state, $trace, $transitions) {
	'ngInject';

	// Enable logging of state transition
	$trace.enable('TRANSITION');

	// Add any logic for handling errors from state transitions
	$state.defaultErrorHandler(function() {
		// console.error('error:', error);
	});

	// Test when application is changing to 'app.start' route
	// to determine if a websocket connected has already been opened
	// so we can re-route the user back to the 'game'
	$transitions.onEnter({ to: 'app.start' }, (trans) => {

	});
}

export function runBlock($log, $state, $trace, $transitions) {
	'ngInject';

	// Enable logging of state transition
	$trace.enable('TRANSITION');

	// Add any logic for handling errors from state transitions
	$state.defaultErrorHandler(function() {
		// console.error('error:', error);
	});

	// Test when application is changing to 'app.game' route
	// to determine if a websocket connection has been OPEN
	// and route the user back to 'start' if not
	$transitions.onEnter({ to: 'app.game' }, (trans) => {
		let websocket = trans.injector().get('websocket');

		if (websocket.$ws) {
			let status = websocket.getStatus();

			if (status !== websocket.STATUS.OPEN) {
				$state.go('app.start');
			}
		}
	});
}

Change route transition so it redirects back to 'start' when websocket isn't OPEN
Change route transition so it redirects back to 'start' when websocket isn't OPEN
