Hyper (v0.11) currently doesn't support compiling to asm.js or wasm using emscripten because mio depends on the Unix system library. Hyper v0.10 is compiling, but I've tried a client request and apparently it can't handle a websocket correctly.
I'd like to ask if supporting emscripten is in the scope of the hyper project, and if it is, what is missing?
(Sorry if this discussion is already going somewhere else, but I couldn't find an issue for it)
hyper is an HTTP implementation in Rust. When building an application with emscripten, you're target platform will be using HTTP from the browser engine (from XHR, Fetch, etc). To conditionally compile hyper for emscripten would probably mean not complining the majority of the crate.
I kind of think that something like that should maybe be a layer above hyper. Maybe something like reqwest, which could change from using hyper to XHR for its HTTP needs...
Maybe not being able to perform a request is totally OK, but compiling would be really useful to use some hyper features such as typed headers and request builders, having those as separate crates would be great as well.
By the way, I've solved my problem using only the emscripten API, in case someone is looking for a quick way to have HTTP requests (limited to GET and POST) on a Rust asm.js compiled App.
@gabisurita
typed headers and request builders
Sounds like the ideal solution might be a crate supporting emscripten and wasm that uses the newhttpcrate for its API, instead.
I would like to get an upgraded connection, so I have an impl AsyncRead/AsyncWrite on both the server an in a wasm frontend... On the server that would work fine right now, but on wasm?
Any tips on what the most realistic strategy is for now? Can I avoid handrolling this in javascript?
Most helpful comment
hyper is an HTTP implementation in Rust. When building an application with emscripten, you're target platform will be using HTTP from the browser engine (from XHR, Fetch, etc). To conditionally compile hyper for emscripten would probably mean not complining the majority of the crate.
I kind of think that something like that should maybe be a layer above hyper. Maybe something like reqwest, which could change from using hyper to XHR for its HTTP needs...