SocketIO connection code changed. Better structured, logged