add configurable disconnect handler