What does Tauri v2 use to run/call its rust backend? #13315
-
Hi! I understand that Tauri uses the systems web view to render the front end of the application. I think I've incorrectly assumed from appearances that this was being done in webview via web assembly. The documentation mentions messaging, and AI seems to believe I am incorrect, so I'm just confirming that I am in fact wrong- and hoping for some clarification here, or to be pointed in the correct direction in the documentation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Messaging sounds like a good word for it. The webviews offer a postMessage both "inside" the js runtime and outside in the host (rust) process. Don't ask me how exactly that webview api works under the hood :D Additionally in v2 we use the browser's normal fetch method against a custom protocol in response to that message to transfer larger payloads faster (postMessage is slow af). WebAssembly is only used when your frontend uses it and it's only used by that frontend. This includes all current Rust frontends like Yew or leptos. |
Beta Was this translation helpful? Give feedback.
Messaging sounds like a good word for it. The webviews offer a postMessage both "inside" the js runtime and outside in the host (rust) process. Don't ask me how exactly that webview api works under the hood :D
Additionally in v2 we use the browser's normal fetch method against a custom protocol in response to that message to transfer larger payloads faster (postMessage is slow af).
Custom protocol is also what's used to serve your frontend files. It's basically a mix of the file:// and http:// protocols you know from web browsers (there's no localhost server involved or something, requests to custom protocols are caught before hitting the network stack).
WebAssembly is only used when your…