Added onDisconnected method to API.