marp |
---|
true |
- Old geek
- Solutions Architect at 🐳 Docker
- Wasm addict
- @k33g_org on 🐦 X
- Talk, chat about Wasm/Wasi
- Some simples exercises
This project is gitpodified with gitpod.io. That means you will run a VSCode environment in the browser. The advantage is that everything is already installed.
=> bandwidth 🥰
- Code > Bytecode (wasm binary file)
- Binary format for executing code on the Web
- The JavaScript VM is responsible for the execution of the WASM code
- WASM is polyglot
- WASM is safe
- A complement to JavaScript
- Near-native speeds
- Complex applications in web browsers
- Speed,
- Efficiency,
- Safe,
- Versatile,
- Portable
- Wasi: WebAssembly System Interface
- Interface between
- WebAssembly (WASM) code
- and a Runtime environment
- Allowing WASM code to be run in various contexts (even the browser)
- CLI applications
- Applications with plug-ins (Zellij, Lapce)
- Database UDF (ScyllaDB, PostgreSQL)
- WebHooks, Filters, … (Webhook Relay, Envoy)
- FaaS (Fermyon cloud, WasmCloud, Shopify, …)
- …
- WASI Runtimes CLI
- WASI Runtimes SDK
- Ready to use applications with embedded Wasm runtime
- Spin from Fermyon
- Wasm Workers Server from Wasm Lab
- …
- WasmEdge,
- Wasmtime,
- Wasmer,
- Wazero 🩵,
- NodeJS,
- …
01-hello-rust.md
02-hello-go.md
03-files-go.md
04-env-var-go.md
05-call-functions-go.md
- Only numbers 😮
- How to pass string arguments to a Wasm function?
- How to return a string as the result of a Wasm function call?
- About WASM, WASI and Strings with NodeJS: https://k33g.hashnode.dev/series/wasi-nodejs
- You can develop your own CLI
- But, you need to handle the limitations
- == Develop all the “plumbing”
wazero: the zero dependency WebAssembly runtime for Go developers
- Make your own CLI
- Call a function (not always simple)
- Make HTTP requests
- Make Redis requests from the Wasm module
- Use MQTT or NATS
- …
- A function defined in the Host application
- For The Wasm program, it’s used as an import function
https://k33g.hashnode.dev/series/wazero-first-steps
- Wazero Cookbook - Part One: WASM function & Host application
- Wazero Cookbook - Part Two: Host functions
- ✋ You need to write your own glue
- For every language you want to support on the Wasm side 😵💫
https://extism.org/docs/category/integrate-into-your-codebase
pdk.Input()
mem := pdk.AllocateString("output")
pdk.OutputMemory(mem)
pdk.Log(pdk.LogInfo,,"")
req := pdk.NewHTTPRequest("GET", url)
pdk.OutputMemory(mem)
...
https://github.com/extism/go-sdk
- Create Extism plug-ins with the Extism PDKs
- Golang
- Rust
- JavaScript
- Use the Extism CLI to call the functions
- Make your own CLI with the Extism Go SDK
- Make an HTTP server to serve wasm functions
https://k33g.hashnode.dev/series/extism-discovery
- Extism & WebAssembly Plugins
- Extism, WebAssembly Plugins & Host Functions
- WebAssembly Plugin in JavaScript with Extism
- Run Extism WebAssembly plugins from a Go application
- Writing Wasm MicroServices with Node.js and Extism
- Write a host function with the Extism Host SDK
- Writing Host Functions in Go with Extism
- Create a Webassembly plugin with Extism and Rust
- WASM Microservices with Extism and Fiber
- Extism Go SDK is now written on top of Wazero
- Run WASM functions from Vert-x & Kotlin thanks to Extism
Preview 2 includes two worlds:
-
wasi-cli, the "command-line interface" world, which roughly corresponds to POSIX. Files, sockets, clocks, random numbers, etc.
-
wasi-http, an HTTP proxy world, organized around requests and responses.
There are more worlds in development, but for now, the important thing is that we do have multiple worlds included. This means wasi-cli world isn't the only world, or even the primary world. It's just one world, among multiple.