Fan to host library

small refactor to move "on connection" code for fan into custom app, to be consistent with on connection code for host.