Connect your Wokwi simulated IoT Devices (e.g. ESP32) to you local network!
For installation and usage instructions, check out the Wokwi ESP32 WiFi Guide
Run wokwigw
and configure Wokwi to use the Private IoT Server:
- In wokwi.com - Press "F1" in the code editor and select "Enable Private Wokwi IoT Gateway".
- In Wokwi for VS Code - Add the following line to your
wokwi.toml
file:
[net]
gateway="ws://localhost:9011"
The wokwigw
tool can forward ports from your local machine to the simulated device. For example, if you have a web server running on port 80 on your simulated device, you can forward port 8080 on your local machine to port 80 on the simulated device:
wokwigw --forward 8080:10.13.37.2:80
To forward a UDP port, add the udp:
prefix. For instance, the following command will forward UDP port 8888 on your local machine to UDP port 1234 on the simulated device:
wokwigw --forward udp:8888:10.13.37.2:1234
You can repeat the --forward
flag multiple times to forward multiple ports.
To connect from the simulation to your local machine (that is the machine running wokwigw), use the host host.wokwi.internal
. For example, if you are running an HTTP server on port 1234 on your computer, you can connect to it from within the simulator using the URL http://host.wokwi.internal:1234/.
make
The compiled binaries go into the bin
directory, as follows:
- wokwigw.exe - Windows, x86_64
- wokwigw-darwin - Mac OS X, x86_64
- wokwigw-darwin_arm64 - Mac OS X, arm64
- wokwigw-linux - Linux, x86_64
- wokwigw-linux_arm64 - Linux, arm64
make test
Gitpod allows you to edit the code, build the project in the cloud, and then download the compiled binary. Here are the instructions:
- Open this project in Gitpod. You may need to authenticate using your GitHub account.
- You'll get an online code editor where you can make changes to the source code. Make your code changes.
- Go to Gitpod's built-in terminal and type
make
to compile the project (you can also typemake test
to run the tests).
You can download the compiled binaries from the bin
directory by locating them in the file explorer, right-clicking the binary you want to download, and selecting "Download...".