npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hola.org/uws

v0.13.0-1

Published

Highly efficient WebSocket & HTTP library

Downloads

7

Readme

  • Autobahn tests all pass.
  • One million WebSockets require ~122mb of user space memory (112 bytes per WebSocket).
  • By far one of the fastest in both HTTP and WebSocket throughput (see table below).
  • Linux, OS X, Windows & Node.js support.
  • Runs with raw epoll, libuv or ASIO (C++17-ready).
  • Valgrind & AddressSanitizer clean.
  • Permessage-deflate, SSL/TLS support & integrates with foreign HTTP(S) servers.
  • Multi-core friendly.

Simple & modern

The interface has been designed for simplicity and only requires you to write a few lines of code to get a working server:

#include <uWS/uWS.h>

int main() {
    uWS::Hub h;

    h.onMessage([](uWS::WebSocket<uWS::SERVER> ws, char *message, size_t length, uWS::OpCode opCode) {
        ws.send(message, length, opCode);
    });

    h.onHttpRequest([](uWS::HttpResponse *res, uWS::HttpRequest req, char *data, size_t length, size_t remainingBytes) {
        res->end(const char *, size_t);
    });

    h.listen(3000);
    h.run();
}

Get the sources of the uws.chat server here. Learn from the tests here.

Widely adopted

Not your average server

µWS was designed to perform well across the board, not just in one specific dimension. With excellent memory usage paired with high throughput it outscales Socket.IO by 180x.

Benchmarks are run with default settings in all libraries, except for ws which is run with the native performance addons. Read more about the benchmarks here.

Getting started

Dependencies

First of all you need to install the required dependencies. This is very easily done with a good open source package manager like Homebrew for OS X, vcpkg for Windows or your native Linux package manager.

Always required:

  • OpenSSL 1.0.x
  • zlib 1.x

Not required on Linux systems:

  • libuv 1.3+
  • Boost.Asio 1.x

On Linux systems you don't necessarily need any third party event-loop library, but can run directly on the high performance epoll backend (this gives by far the best performance and memory usage). Non-Linux systems will automatically fall back to libuv.

If you wish to integrate with a specific event-loop you can define USE_ASIO or USE_LIBUV as a global compilation flag and then link to respective libraries.

Compilation

Clone and enter the repo:

  • git clone https://github.com/uWebSockets/uWebSockets.git && cd uWebSockets
OS X & Linux

Compile with Make:

  • make
  • sudo make install
Windows

Compile with Visual C++ Community Edition 2015 or later. This workflow requires previous usage of vcpkg:

  • Open the VC++ project file
  • Click Build