Another small step to wasm compatibility (actix actors in the browser)

#1

Some work has been going on in the actix universe. Recently the runtime which now uses tokio has been split of in a separate crate actix-rt. I have done some further work and removed all tokio dependencies of actix except tokio-timer, which is innocent.

It was now time to look at what would be involved in creating a wasm compatible runtime for actix. As it turns out, surprisingly little. The only really necessary part of the actix runtime API is Arbiter::spawn, which allows spawning futures. As it turns out wasm-bindgen has local_spawn which converts rust futures to javascript promises and runs them to completion.

So I did a little experiment as a proof of concept. This does not at all ressemble a clean port of the API that could be publicly released, just proof of concept. You can see actix actors playing ping pong in the browser here:

8 Likes