Wasm Labs

Wasm Workers Server 1.5, with Neural Network (wasi-nn) support!

By Rafael Fernández
At 2023 / 09 5 mins reading

Artificial Intelligence is everywhere these days. The primary goal of Wasm Workers Server (wws) is to serve developers, letting them design, build and run polyglot applications. Thanks to Artificial Intelligence in general, and Generative Artificial Intelligence in particular, applications can be greatly vitamined -- becoming even more useful to their users, with relatively low integration efforts.

To upgrade to the latest version, you only need to reinstall Wasm Workers Server by running the following command:

curl -fsSL https://workers.wasmlabs.dev/install | bash

The main features on this release are:

We would like to thank our community contributors!

Develop AI-powered workers

WebAssembly, and in particular the WebAssembly System Interface has a proposal in the works, called wasi-nn (WASI Neural Network) that specializes in the usage of WebAssembly for machine learning (ML) purposes in general, and for performing inference in particular.

We are very happy to announce the WASI-NN integration in the 1.5 release of Wasm Workers Server 🎉 This integration enables the OpenVINO backend on the host side, and is able to load and run models encoded for this runtime. You can expect more backends coming in the future; feel free to make your contribution to Wasm Workers Server if you want to see other runtimes in the offering!

You can find all the details and instructions to try the AI integration on Wasm Workers Server on this article.

Container image entrypoint update

Thanks to this small, but important change, it's easier to run the WWS container when providing different arguments.

$ docker run ghcr.io/vmware-labs/wws:v1.5.0 --version
wasm-workers-server 1.5.0

HeDui contributed Separate ENTRYPOINT and CMD on the container image,

CORS support

The same-origin policy is a mechanism that protects users from loading hazardous resources, or performing malicious requests to domains other than the one they are visiting in their browser.

In order for these resources to be loadable, or for these requests to be performed by the browser, the server has to provide in advance a list of domains other than the current one that are fine to be contacted by the website we are visiting. Cross-Origin Resource Sharing (CORS) allows exactly this.

We can enable this feature on Wasm Workers Server by using the --cors argument:

$ wws --cors https://alternative-domain.com examples/js-basic
⚙️ Preparing the project from: examples/js-basic
⚙️ Loading routes from: examples/js-basic
⏳ Loading workers from 1 routes...
✅ Workers loaded in 112.734792ms.
- http://127.0.0.1:8080/
=> examples/js-basic/index.js
🚀 Start serving requests at http://127.0.0.1:8080

The new --cors flag can be provided multiple times with different domains. When issuing a request, we can see that the Access-Control-Allow-Origin header is automatically added by Wasm Workers Server.

$ curl -s -vvv http://localhost:8080/ > /dev/null
(snip)
< HTTP/1.1 200 OK
< content-length: 753
< access-control-allow-origin: https://alternative-domain.com
< content-type: text/html
< x-generated-by: wasm-workers-server
< date: Wed, 06 Sep 2023 08:20:05 GMT
(snip)

Workers have the ability to answer to the request with the headers they wish (Access-Control-Allow-Origin too). If a worker provides an Access-Control-Allow-Origin header, it will have priority over the global one configured on the Wasm Workers Server instance.

Narayan Bhat contributed this feature filed in this issue.

Community contributions

We are very thankful to the growing community of Wasm Workers Server for their valuable feedback, bug reports and fixes that make Wasm Workers Server better for everyone! Some of the fixes and improvements that were merged on this version:

Thanks to all of you as well as to those who are not listed and contributed in many other ways too.

If you are looking to contribute to Wasm Workers Server, there will be a lot of opportunities in the future. You can share your ideas for the project on the Discussions section and look for good first issues in the repository 🤩.

Closing

There are more ⚡ cool features ⚡ coming with the next release of Wasm Workers Server. Stay tuned!

We hope you enjoy Wasm Workers Server 1.5! Do not forget to follow us at @vmwwasm and share your feedback!

Do you want to stay up to date with WebAssembly and our projects?