go-libp2p-webrtc-direct/examples/wasm
web3-bot 41a3151f0a
sync: update CI config files (#51)
* bump go.mod to Go 1.17 and run go fix

* bump go.mod to Go 1.17 and run go fix

* bump go.mod to Go 1.17 and run go fix

* bump go.mod to Go 1.17 and run go fix

* add version.json file

* update .github/workflows/automerge.yml

* update .github/workflows/go-test.yml

* update .github/workflows/go-check.yml

Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
2022-04-06 12:57:18 +02:00
..
README.md Document WASM support 2019-04-01 21:21:32 +02:00
go.mod sync: update CI config files (#51) 2022-04-06 12:57:18 +02:00
go.sum sync: update CI config files (#47) 2021-11-19 15:19:01 +01:00
main.go sync: update CI config files (#47) 2021-11-19 15:19:01 +01:00

README.md

wasm

This example demos WASM support.

The example is supposed to be ran against one of the standalone examples in listening mode. Note that the example only supports the Dial side since Listen uses an HTTP server which isn't available in a browser.

Usage

Install dependencies

TODO: Check the root readme

Run

GOOS=js GOARCH=wasm go build -o main.wasm

Next, refer to the Go documentation for how to run a wasm file.

Output in the browser console

[dialer] Opened connection wasm_exec.js:47:6
[dialer] Opened stream

Output in the listener

[listener] Got stream
[listener] Received:
hey, how is it going. I am the dialer