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

proxied-node

v0.2.0

Published

A proxied-worker for NodeJS

Readme

proxied-node

This is exactly the same proxied-worker module, specific for a NodeJS proxied namespace.

The only difference is that the client side is already the exported namespace, not a Worker to initialize, and transported data uses the Structured Clone algorithm, enabling both recursive data, but also much more than what JSON allows.

Check the oled screen demo to try it out on a Raspberry Pi.

API

The default export is a common server handler factory function.

It accepts few configurations options to enable a variety of use cases, even multiple proxied namespaces, whenever that's needed.

// same as: const proxiedNode = require('proxied-node');
import proxiedNode from 'proxied-node';

// handler(request, response, next = void 0)
const handler = proxiedNode({
  wss,        // a WebSocketServer options or a WebSocketServer instance
  namespace,  // the namespace to proxy to each client
  match,      // an optional client side URL to match. By default is /js/proxied-node.js
  host,       // an optional host name to use. it's IPv4 / localhost otherwise
  port,       // an optional  port to use when wss is an instance of WebSocketServer already
});

// express
app.use(handler);

// or standard http
createServer((req, res) => {
  if (handler(req, res))
    return;
  // ... rest of the logic
});

Server Side Example

const express = require('express');
const proxiedNode = require('proxied-node');

const {PORT = 8080} = process.env;

const app = express();

const handler = proxiedNode({
  wss: {port: 5000},
  namespace: {
    test: 'OK',
    exit() {
      console.log('bye bye');
      process.exit(0);
    },
    sum(a, b) {
      return a + b;
    },
    on(type, callback) {
      setTimeout(() => {
        callback('Event', type);
      });
    },
    async delayed() {
      console.log('context', this.test);
      // postMessage({action: 'greetings'});
      return await new Promise($ => setTimeout($, 500, Math.random()));
    },
    Class: class {
      constructor(name) {
        this.name = name;
      }
      sum(a, b) {
        console.log(this.name, a, b);
        return a + b;
      }
    }
  }
});

app.use(handler);
app.use(express.static(__dirname));
app.listen(PORT);

Client Side Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>proxied-node</title>
  <script type="module">
  // the namespace is exported automatically as default
  import('/proxied-node.js').then(async (nmsp) => {
    console.log(await nmsp.test);
    console.log(await nmsp.sum(1, 2));
    await nmsp.delayed();

    const instance = await new nmsp.Class('🍻');
    console.log(await instance.sum(1, 2));

    nmsp.on('listener', type => {
      console.log('listener', type);
    });

    const btn = document.body.appendChild(document.createElement('button'));
    btn.addEventListener('click', () => { nmsp.exit(); });
    btn.textContent = '☠ exit';
  });
  </script>
</head>
</html>