Language: English
Just a little try to create simple WebAssembly using GO.
So i'll explain my understanding about this project, here's the structure how WebAssembly GO Works:
Server
path:server/main.go
this is for the web server, wich will catch address and throw back some WebAssembly Component that will be display to user (In this implementation i use8081
port). Just run this, and the server will be active.
WebAssembly GO
path:wasm/main.go
this is for the WebAssembly code, wich we can build to.wasm
file using:
GOOS=js GOARCH=wasm go build -o ../main.wasm
.
All of these components is interrelated,
-
Client/User
--(sending request address)-->server/main.go
Then server will preparing the WASM,
server/main.go
--(preparing)-->WASM Component
(index.html, script.js, main.wasm) -
WASM Preparing process:
index.html
--(get WASM action through js)-->script.js
--(js Get WASM action)-->main.wasm
-
And finally,
main.wasm
will return some action toindex.html
throughscript.js
so that client/user can receive the requested action in index.html
Youtube Reference: Go and WebAssembly | Learn the Basics of WASM
- Clone this repo (
git clone https://github.com/Khip01/Simple-WASM_Go.git
) - Then run the server/main.go
- Visual Studio Code