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 🙏

© 2026 – Pkg Stats / Ryan Hefner

uws-extends

v0.1.1

Published

众所周知,每次短小的请求,大部分时间开销都在握手上;使用 webSockets 可以有效减少每次握手时间,但是它不如 http 使用直观。 此库的目的是 让 ws 和 http 请求一样直观,为了更好的兼容,此库仅是在 uWebSockets 基础上进行扩展。

Readme

uWebSockets 的扩展

众所周知,每次短小的请求,大部分时间开销都在握手上;使用 webSockets 可以有效减少每次握手时间,但是它不如 http 使用直观。 此库的目的是 让 ws 和 http 请求一样直观,为了更好的兼容,此库仅是在 uWebSockets 基础上进行扩展。

server:

将每个 webSockets 消息抽象成路由,进行处理

const { App } = require('@nuage/uws'); // @nuage/uws 仅是 uWebSockets 的nodejs发布版本
const { bindUWS } = require('uws-extends/lib/server-ws');

const uws = bindUWS(App());

uws.on('/hello', async data => {
  console.log(data); // {hello:'world'}

  return { name: 'dog', age: 5 };
});

uws.listen(4000, listener => {
  if (listener) {
    // tslint:disable-next-line
    console.log(`uws runing: ws://0.0.0.0:5000`);
  }
});

client:

客户端每次发起请求时,会检查是否断链,如果断开连接,会重新连接 webSockets;如果客户端超过 30 秒未和服务端通讯,客户端会主动断开连接。

客户端请求之后,会模拟 http 的请求回调用,达到和编写 http 类似的行为

import { createClientWS } from 'uws-extends/lib/client-ws';

const cws = createClientWS('ws://127.0.0.1:4010');

const fetchSometing = async () => {
  const res = await cws.fetch(`/hello`, { hello: 'world' });

  console.log(res); // { name: 'dog', age: 5 };
};

fetchSometing();