code: def connection_lost(self, exc):
          
          if exc:
              log.exception('disconnected due to exception')
          else:
              log.info('disconnected because of close/abort.')
          if self.disconnect_callback:
              self.disconnect_callback(exc)
docs: Log when connection is closed, if needed call callback.