by LSRegression · 2y ago · 0 comments
By compiling my backend code to WASM I basically do that - the client can use either a client-side 'server' or connect to a real server. The UI code itself is unchanged in either case.
I suppose the need in this case is that I have code written in a language other than JS and I want to run it in a browser; inversely I could have written the entire project in JS and hosted my backend server on say Node.
Did you mean single player? Although perhaps I'm just old and thinking about this in a strange way.
And can I clarify.. your scrabble app is web based already right? connecting to a rust web server for the game logic? And you want to embed that server by compiling to wasm? I probably should go read up on how this works.
> connecting to a rust web server for the game logic? And you want to embed that server by compiling to wasm?
I would assume so, and it being in WASM means they can use the exact same binary code on the server and in the webbrowser.
You could of course do the same thing by writing in Javascript (running in Node on the server or in the browser) but then you are in JS instead of Rust.