wasip2-examples: Tokio example apps for wasm32-wasip2#1
Draft
wasip2-examples: Tokio example apps for wasm32-wasip2#1
Conversation
Agent-Logs-Url: https://github.com/Heap-Hop/tokio/sessions/7f154f27-e027-470a-93e7-258d0aa4d216 Co-authored-by: Heap-Hop <62206297+Heap-Hop@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add examples for running Tokio with Wasip2
wasip2-examples: Tokio example apps for wasm32-wasip2
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR tokio-rs#7933 landed networking support for
wasm32-wasip2. This adds awasip2-examples/crate that documents the current support scope and validates it with runnable examples.What works on
wasm32-wasip2current_threadruntime,tokio::spawn,tokio::select!tokio::time(sleep, interval, timeout)tokio::sync(mpsc, oneshot, Mutex, Semaphore, Barrier)TcpListener/TcpStream/TcpSockettokio_unstable+wasmtime -Sinherit-networkUdpSocket(send/recv)tokio_unstable+wasmtime -Sinherit-networkrt-multi-thread,tokio::fs,tokio::process, DNSSO_LINGER,POLLHUP, broadcast, multicast, peekNew crate:
wasip2-examples/Standalone crate (outside workspace) — only needs
rt, macros, net, io-util, time, sync:01-hello.rs— timers, mpsc/oneshot channels, spawn, select!, timeout; no network02-tcp-echo.rs—TcpListenerbinds ephemeral port, echo-server task accepts,TcpStreamclient round-trips three messages03-udp-echo.rs— twoUdpSockets exchange datagrams withsend_to/recv_from04-concurrent-tasks.rs— work queue (mpsc), shared counter (Mutex), rate limiter (Semaphore), rendezvous (Barrier)All four use
#[tokio::main(flavor = "current_thread")]— the multi-thread runtime is unavailable on wasip2.Running
CI
Build + run steps added to the existing
wasm32-wasip2job inci.yml.