code: def _on_close(self, socket):
          
          self.logger.debug('Connection closed.')
  
          for subscription in self.subscriptions.values():
              if subscription.state == 'subscribed':
                  subscription.state = 'connection_pending'
docs: Called when the connection was closed.