Skip to content

Make HTTP requests from inside WASM using knqyf263/go-plugin . Devcontainer.

License

Notifications You must be signed in to change notification settings

wasm-outbound-http-examples/go-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use knqyf263/go-plugin to send HTTP(s) requests from inside WASM

This devcontainer is configured to provide you a knqyf263/go-plugin's CLI tool installation, Go and TinyGo toolchains, and a protobuf-compiler.

Open in GitHub Codespaces

The sample code and following instructions are partially based on go-plugin's examples and go-plugin's tutorial.

Instructions for this devcontainer

Tested with protoc-gen-go-plugin 0.8.0, protobuf-compiler 3.12.4, Go 1.21.7, TinyGo 0.30.0.

Preparation

  1. Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.

Building

  1. Generate the SDK codes based on interfaces declared in protobufs/myschema.proto file:
cd protobufs
protoc --go-plugin_out=. --go-plugin_opt=paths=source_relative myschema.proto

This will generate 4 new .go files in protobufs directory.

  1. Compile the plugin sample:
cd ../plugin
tinygo build -o plugin.wasm -scheduler=none -target=wasi --no-debug plugin.go

This will generate plugin.wasm in plugin directory.

  1. Run the main ("host") program, which makes use of the plugin.wasm:
cd ..
go run main.go

Finish

Perform your own experiments if desired.


Created for (wannabe-awesome) list