From e7dd632633ad6141ee8020b4191cacdc0f3af3e1 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Sun, 16 Aug 2026 07:08:30 +0200 Subject: [PATCH] Working ws --- src/App.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 10804b5..9d4a684 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import reactLogo from "./assets/react.svg"; import { invoke } from "@tauri-apps/api/core"; import "./App.css"; @@ -8,7 +8,12 @@ function App() { const [greetMsg, setGreetMsg] = useState(""); const [name, setName] = useState(""); + const initialized = useRef(false); + useEffect(() => { + if (initialized.current) return; + initialized.current = true; + (async () => { const ws = new EnclaveWebSocket("ws://localhost:3415"); @@ -20,7 +25,7 @@ function App() { hostname: "", }); - // console.log(await ws.read()); + console.log(await ws.read()); })(); }, []);