uWebsockets.js for FreeBSD
Go to file
Alex Hultman 80bc15915b Wrap req.getParameter, req.getUrl 2019-01-14 12:44:29 +01:00
dist Apache 2.0 license 2018-11-15 16:01:49 +01:00
examples Wrap req.getParameter, req.getUrl 2019-01-14 12:44:29 +01:00
src Wrap req.getParameter, req.getUrl 2019-01-14 12:44:29 +01:00
uWebSockets@8efea340e6 Properly support SSL and non-SSL 2019-01-08 22:04:56 +01:00
.gitmodules Add uWebSockets submodule 2018-11-04 00:11:12 +01:00
LICENSE Apache 2.0 license 2018-11-15 16:01:49 +01:00
Makefile Wrap up SSL, initial WebSocket support 2018-12-26 13:50:12 +01:00
README.md First binary release 2019-01-08 22:25:03 +01:00
addon.pro Add QtCreator project for addon 2019-01-14 11:45:25 +01:00
benchmarks.png Add files via upload 2018-11-03 12:41:47 +01:00
host.pro Make it embeddable as standalone 2018-11-04 09:01:51 +01:00
make.bat Le dump 2018-10-28 16:07:21 +01:00

README.md

µWebSockets.js is a JavaScript platform, runtime and web server built on µWebSockets v0.15 and V8.

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

For the most common Node.js systems are available precompiled binaries:

npm install uNetworking/uWebSockets.js#semver:0.0.1

or any such version.

/* 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 75% of native C++ µWebSockets v0.15. That puts it some 20x as fast as Deno and even faster than most C++-only servers, all from within a JavaScript VM.

Build from source

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