Called when the connection was closed.

def _on_close(self, socket):
        """
        Called when the connection was closed.
        """
        self.logger.debug('Connection closed.')

        for subscription in self.subscriptions.values():
            if subscription.state == 'subscribed':
                subscription.state = 'connection_pending'