added onConnected and onDisconnected