uWebsockets.js for FreeBSD
Go to file
2018-11-05 02:22:20 +01:00
dist Try and fix macOS build, report actial error on catch 2018-11-05 02:22:20 +01:00
examples Make the two runtimes capable of sharing the same example 2018-11-04 23:46:50 +01:00
src Don't capture isolate 2018-11-05 01:42:54 +01:00
uWebSockets@6231aceaef Update uWS 2018-11-04 22:45:07 +01:00
.gitmodules Add uWebSockets submodule 2018-11-04 00:11:12 +01:00
benchmarks.png
host.pro Make it embeddable as standalone 2018-11-04 09:01:51 +01:00
make.bat
Makefile Try and fix macOS build, report actial error on catch 2018-11-05 02:22:20 +01:00
README.md Update README.md 2018-11-05 00:54:58 +01:00

µWebSockets.js is a JavaScript platform, runtime and web server. It can serve Http about 6x that of Node.js and 12x that of Deno and outperforms Golang's fasthttp with ease.

There are two modes; compiled as a stand-alone JavaScript runtime or as a Node.js native addon.

/* The stand-alone runtime has uWS namespace already loaded. */
var uWS = uWS ? uWS : require('../dist/uws.js');

const world = 'Strings are slower than ArrayBuffer but who cares for demo purose!';
const port = 3000;

uWS.App().get('/hello', (res, req) => {
  res.end(world);
}).get('/*', (res, req) => {
  res.writeHeader('content-type', 'text/html; charset= utf-8').end(req.getHeader('user-agent') + ' är din user agent, biatch!');
}).listen(port, (token) => {
  if (token) {
    console.log('Listening to port ' + port);
  } else {
    console.log('Failed to listen to port ' + port);
  }
});

Benchmarks

Performance retention is up to 70% of native C++ µWebSockets v0.15.

Kick-start

Easiest is to compile yourself a Node.js native addon. The following works for Linux and macOS systems:

git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
cd uWebSockets.js
make
node examples/HelloWorld.js