In this lesson we are going to setup a project from scratch by introducing the JavaScript snippet to load a WebAssembly module. We demonstrate two different ways and showcase the benefit of the streaming solution. Once the module is loaded we can invoke a function previously exported from our Rust code.
@Steve totally, just pinged the Egghead team to fix it. thx!
Hi Nik,
When I run http
(from the utils directory) in my terminal, this prompt is returned:
http: error: the following arguments are required: URL
When I run ```http url``, I get an error:
http: error: ConnectionError: HTTPConnectionPool(host='url', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x101bff518>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',)) while doing GET request to URL: http://url/
What would be the best way to troubleshoot this issue?
Thanks so much :-)
@Juliette you're not invoking rust http server, your http
is most likely an alias for the httpie client. Try this: ~/.cargo/bin/http
Cargo.toml:
...
[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
Without 'path' variable cargo dont produce utils.wasm file in target/wasw32-unknown-unknown directory
Thank you @Mirza! I'm going to give that a try tomorrow after my first cup of coffee or so. Cheers:-)
Thanks for helping @Mirza
FYI I needed to prefix my build commands with rustup run nightly cargo build ...
in order to avoid crate errors and a suggestion that wasm32-unknown-unknown
target may not be installed.
WebAssembly.instantiateStreaming
is not supported in Safari, and either in Safari iOS, just in case someone like me is going to wonder why the results are different in Chrome and Safari: https://caniuse.com/#search=instantiateStreaming
I don't have an alias for http, command not found: http
also ~/.cargo/bin/http
doesn't exist, is there a way to install it?