Skip to content

seemueller-io/axum-async-graphql-subscriptions-wasm32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Axum Async GraphQL Subscriptions for wasm32-unknown-unknown

Why?

GraphQL + Rust + Web Assembly Edge Runtime = world-class api substrate

What makes this so hard?

  1. Practically zero real-world examples.
  2. WebSocket connections in Wasm environments require special handling since traditional TCP/WebSocket servers cannot be directly instantiated.
  3. Many Rust async ecosystem dependencies (like tokio, mio) assume native platform capabilities that aren't available in wasm32-unknown-unknown target.
  4. GraphQL subscriptions traditionally rely on long-lived connections and event streaming, which need to be carefully adapted for edge computing environments.

Done

  1. Cloned a set of examples and confirmed the subscription example was operational prior to modification.
  2. Added worker dependencies to the subscription example.
  3. Added a fetch handler to replace TCPListener
  4. Forked async-graphql dependency and removed platform gates on subscriptions.
  5. Created mio patched. All transitive usage of mio is patched with a dummy mio as a crate in the workspace.
  6. Update all getrandom resolutions to include the 'wasm_js' feature
  7. Added RUST_FLAGS to the build command.

Not Done

  1. Validate features

Notes

  1. You may be better off writing an extractor for websockets. If this approach is taken, try yanking sources and refactor logic which relies on tokio features incompatible with wasm32.

About

axum-async-graphql-subscriptions-wasm32

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published