def open(self, state: fos.StateDescription) -> None:
        """Open the client connection

        Arg:
            state: the initial state description
        """
        if not self._closed.is_set():
            raise RuntimeError("Client is already running")

        def run_client() -> None:
            def subscribe() -> None:
                response = requests.post(
                    f"{self.origin}/events",
                    stream=True,
                    headers={
                        "Accept": "text/event-stream",
                        "Content-type": "application/json",
                    },
                    data=json_util.dumps(
                        asdict(
                            ListenPayload(
                                events=[
                                    "capture_notebook_cell",
                                    "close_session",
                                    "reactivate_notebook_cell",
                                    "refresh",
                                    "reload_session",
                                    "select_labels",
                                    "select_samples",
                                    "set_color_scheme",
                                    "set_dataset_color_scheme",
                                    "set_group_slice",
                                    "set_sample",
                                    "set_spaces",
                                    "state_update",
                                ],
                                initializer=state,
                                subscription=self._subscription,
                            ),
                            dict_factory=dict_factory,
                        )
                    ),
                )
                source = sseclient.SSEClient(response)
                for message in source.events():
                    event = Event.from_data(message.event, message.data)
                    self._dispatch_event(event)

            while True:
                try:
                    _ping(f"{self.origin}/fiftyone")
                    self._connected = True
                    subscribe()
                except Exception as e:
                    if logger.level == logging.DEBUG or foc.DEV_INSTALL:
                        raise e

                if self._closed.is_set():
                    break

                self._connected = False
                print(
                    "\r\nCould not connect session, trying again "
                    "in 10 seconds\r\n"
                )
                time.sleep(10)

        self._thread = Thread(target=run_client, daemon=True)
        self._closed.clear()
        self._thread.start()
Open the client connection

        Arg:
            state: the initial state description
        
fiftyone/core/session/client.py