joshxyzhimself
jxyz

jxyz

JavaScript HTTP & WebSocket Server with uWebSockets

Photo by KUSHAGRA DHALL on Unsplash

JavaScript HTTP & WebSocket Server with uWebSockets

joshxyzhimself's photo
joshxyzhimself
·Aug 4, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Work in progress, will be updated.

Overview

uWebSockets.js is an HTTP & WebSocket Server module.

Prerequisites

  • Understanding of HTTP
  • Understanding of HTTP statuses (200, 4xx, 5xx)
  • Understanding of HTTP headers
  • Understanding of HTTP requests and responses
  • Understanding of WebSockets

Use Cases

  • Creating an HTTP Server (request-response communication)
  • Creating an HTTP WebSocket Server (bi-directional communication)
  • Serving web pages
  • Serving web sessions
  • Serving REST APIs

Supported Environments

  • Node.js

Why uWebSockets.js

  • Faster than Node.js built-in HTTP module. uWebSockets.js uses the uWebSockets module written in C++.
  • Faster than Express.js, Fastify.js, Koa.js, and Hapi.js (existing Web Framework modules that use the Node.js built-in HTTP module).
  • Faster than Socket.IO and WS (existing WebSocket modules that use the Node.js built-in HTTP module).
  • Standards compliant, with perfect Autobahn|Testsuite score since 2016.
  • Battle-tested, used by cryptocurrency exchanges around the world.
  • Comes with documentation, TypeScript types, and examples.
  • More information here: github.com/uNetworking/uWebSockets.js

Installation

npm install github:uNetworking/uWebSockets.js#v20.10.0

Usage

TODO

References (what else can i read more)