docs: def connect(self):
          """Connects to the 0MQ socket and starts publishing."""
          distributed_logger.info('Connecting registry proxy to ZMQ socket %s', self.socket_addr)
          self.zmq_context = zmq.Context()
          sock = self.zmq_context.socket(zmq.PUB)
          sock.set_hwm(0)
          sock.setsockopt(zmq.LINGER, 0)
          sock.connect(self.socket_addr)
          distributed_logger.info('Connected registry proxy to ZMQ socket %s', self.socket_addr)
  
          def _reset_socket(values):
              for value in values:
                  try:
                      _reset_socket(value.values())
                  except AttributeError:
                      value.socket = sock
  
          distributed_logger.debug('Resetting socket on metrics proxies')
          _reset_socket(self.stats.values())
          self.socket = sock
          distributed_logger.debug('Reset socket on metrics proxies')