Working ws
This commit is contained in:
+18
-1
@@ -1,12 +1,29 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import reactLogo from "./assets/react.svg";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import "./App.css";
|
||||
import { EnclaveWebSocket } from "./protocol/ws";
|
||||
|
||||
function App() {
|
||||
const [greetMsg, setGreetMsg] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const ws = new EnclaveWebSocket("ws://localhost:3415");
|
||||
|
||||
ws.send({
|
||||
method: "Initialize",
|
||||
public_key: "",
|
||||
signature: "",
|
||||
timestamp: 0,
|
||||
hostname: "",
|
||||
});
|
||||
|
||||
// console.log(await ws.read());
|
||||
})();
|
||||
}, []);
|
||||
|
||||
async function greet() {
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
setGreetMsg(await invoke("greet", { name }));
|
||||
|
||||
Reference in New Issue
Block a user