def connect(self, origin=None):
        """
        Connects to the server.

        :param origin: (Optional) The origin.
        """
        self.logger.debug('Establish connection...')

        if self.connected:
            self.logger.warning('Connection already established. Return...')
            return

        if origin is not None:
            self.origin = origin

        self.auto_reconnect = True

        self.ws_thread = threading.Thread(
            name="APIConnectionThread_{}".format(uuid.uuid1()),
            target=self._run_forever)
        self.ws_thread.daemon = True
        self.ws_thread.start()
Connects to the server.

        :param origin: (Optional) The origin.