8000 GitHub - Markcial/goita: Minimal desktop application with webview, websockets and WASM · GitHub
[go: up one dir, main page]

Skip to content
MarkcialPublic

About

Minimal desktop application with webview, websockets and WASM

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪟 goita

Minimal desktop application with webview, websockets and WASM, using only Go.

License: MIT Go 1.16+ WebAssembly webview GitHub stars

goita demo

This is an experiment on how to create a minimal desktop application using only the Go language.

✨ How it works

  • 🪟 Native window through webview, pointed at a local server
  • 📦 Embedded WASM: main.go embeds the WebAssembly build (//go:embed) and serves it on a random free port
  • 🔌 Websocket bridge: the UI (Go compiled to WASM) and the app talk through JSON messages
  • 🧱 Typed protocol: the bridge package defines the request/response types on both sides
goita/
├── main.go      # desktop app: embeds the WASM, starts the server, opens the webview
├── bridge/      # shared JSON message types (Request / Response) and Process()
├── wasm/        # UI code compiled to WebAssembly (honnef.co/go/js/dom/v2)
└── storage/     # generated main.wasm + wasm_exec.js land here

A message from the UI and its answer:

{ "kind": "GetOsDetails", "data": {} }
{ "kind": "GetOsDetails", "data": { "Arch": "amd64", "Os": "linux" } }

Response values depend on your machine. The other supported message is GetUserName.

🧰 Requirements

  • 🐹 Go 1.16 or newer
  • 🖥️ The system webview libraries required by webview. On Linux the pinned module links with pkg-config packages gtk+-3.0 and webkit2gtk-4.0.

🚀 Run it

From the repository root, generate the WebAssembly assets:

go generate wasm/main.go

That copies wasm_exec.js into storage/ from $GOROOT/lib/wasm (Go 1.24 and newer) or $GOROOT/misc/wasm (older Go), then builds storage/main.wasm.

Run the desktop app:

go run main.go

A webview window will appear, and there you can start querying for the system platform or the username that started the application.

🔗 See also

  • 🦀 rusty: the same idea in pure Rust (wry + WASM)

📄 License

MIT


Made by Marc Garcia · marcgarcia.dev · @marc_garcia on X · GitHub

About

Minimal desktop application with webview, websockets and WASM

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0