Open DIMFLIX-OFFICIAL opened 11 months ago
This should mean that you're missing the rust part of the usage instructions from the readme.
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_websocket::init()) // <- This line!
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
This should mean that you're missing the rust part of the usage instructions from the readme.
fn main() { tauri::Builder::default() .plugin(tauri_plugin_websocket::init()) // <- This line! .run(tauri::generate_context!()) .expect("error while running tauri application"); }
I have this line. But I still have this error.
Hmm, can you double check if all the versions are on their latest v2 alpha version?
So for rust it's tauri
tauri-build
and tauri-plugin-websocket
that has to be 2.0.0-alpha
(or the concrete version) and then run cargo update
in the src-tauri dir.
For the js packages it should be enough to re-run the install commands like npm install --save @tauri-apps/api @tauri-apps/plugin-websocket
P.S. i just tried it in a fresh create-tauri-app and there it works so hopefully we're just dealing with an outdated version here.
@FabianLars
Ohhh, we're talking about mobile. Sorry, should have asked that. It could be that the websocket plugin doesn't support mobile yet but that should print different errors 🤔
I'll try it out in my app as soon as i can (have to set up my android env again though)
Ohhh, we're talking about mobile. Sorry, should have asked that. It could be that the websocket plugin doesn't support mobile yet but that should print different errors 🤔
I'll try it out in my app as soon as i can (have to set up my android env again though)
Yes, it's a mobile app.
I have the same problem, but I'm on desktop app.
https://tauri.app/plugin/websocket/ Follow this document.
I can't get the data in the code, but I can see the data in the console ws request? ?
useEffect(() => {
let ws: WebSocket | null = null;
const connectWebSocket = async () => {
try {
ws = await WebSocket.connect("ws://localhost:2900/ws");
ws.addListener((msg) => {
console.log("Received Message:", msg);
});
await ws.send("Hello World! 11111");
} catch (error) {
console.error("WebSocket failed:", error);
}
};
connectWebSocket();
return () => {
ws?.disconnect();
};
}, []);
@RainyNight9 And you also registered it in rust like this? https://github.com/tauri-apps/plugins-workspace/issues/746#issuecomment-1819646642
@FabianLars Yes, registered.
11-20 17:14:05.142 28311 28311 E Tauri/Console: File: http://tauri.localhost/ - Line 0 - Msg: Uncaught plugin websocket not found
main.ts
I did everything according to the instructions https://github.com/tauri-apps/tauri-plugin-websocket/tree/v2
It doesn't work