uwebsockets
Version:
µWebSockets.js is a web server bypass for Node.js that reimplements eventing, networking, encryption, web protocols, routing and pub/sub in highly optimized C++. As such, µWebSockets.js (websockets) delivers web serving for Node.js, 8.5x that of Fastify a
24 lines (19 loc) • 649 B
JavaScript
/* Minimal HTTP/3 example */
const uWS = require('../dist/uws.js');
const port = 9001;
/* ./quiche-client --no-verify https://localhost:9001 */
/* The only difference here is that we use uWS.H3App rather than uWS.App or uWS.SSLApp.
* And of course, there are no WebSockets in HTTP/3 only WebTransport (coming) */
const app = uWS.H3App({
key_file_name: 'misc/key.pem',
cert_file_name: 'misc/cert.pem',
passphrase: '1234'
}).get('/*', (res, req) => {
res.end('H3llo World!');
}).listen(port, (token) => {
if (token) {
console.log('Listening to port ' + port);
} else {
console.log('Failed to listen to port ' + port);
}
});