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

@axiomify/socket.io

v6.3.3

Published

Socket.IO bridge for @axiomify/native — attach Socket.IO to the same uWebSockets.js server that handles HTTP, so you only need one listener.

Readme

@axiomify/socket.io

npm version codecov OpenSSF Scorecard License: MIT

Socket.IO 4.4+ bridge for @axiomify/native. One uWS listener serves your HTTP routes, native WebSocket routes, and Socket.IO — no second process, no proxy, no port juggling.

Install

npm install @axiomify/socket.io socket.io

socket.io is a peer dependency; use ≥ 4.4.0 (earlier versions lack attachApp(uWSApp)).

Quick start

import { Axiomify } from '@axiomify/core';
import { NativeAdapter } from '@axiomify/native';
import { attachSocketIO } from '@axiomify/socket.io';

const app = new Axiomify();
const adapter = new NativeAdapter(app, { port: 3000 });

// MUST run before adapter.listen() — uWS rejects route changes on a
// listening socket. attachSocketIO is async because it dynamic-imports
// socket.io (which keeps the install footprint clean for projects that
// don't need this bridge).
const io = await attachSocketIO(adapter, {
  cors: { origin: 'https://app.example.com' },
});

io.on('connection', (socket) => {
  socket.emit('welcome');
  socket.on('chat', (msg) => io.emit('chat', msg));
});

adapter.listen();

The returned io is a stock socket.io Server instance — every API you know works as-is.

Reusing Axiomify plugins as Socket.IO middleware

Auth, rate-limit, and fingerprint plugins all work as io.use(...) middleware via the adapter helper:

import { createAuthPlugin } from '@axiomify/auth';
import { adaptAxiomifyPlugin } from '@axiomify/socket.io';

const requireAuth = createAuthPlugin({ secret: process.env.JWT_SECRET! });

io.use(adaptAxiomifyPlugin(requireAuth));

io.on('connection', (socket) => {
  console.log('user', socket.data.user); // assigned by the auth plugin
});

If the plugin calls res.status(401).send(null, 'Unauthorized'), Socket.IO refuses the connection with a connect_error carrying err.data.statusCode = 401.

Graceful shutdown

drainOnAdapterShutdown (default true) wires Socket.IO's io.close() into the adapter's drain sequence:

adapter.gracefulShutdown({
  timeoutMs: 15_000,
  onShutdown: async () => {
    // Runs AFTER all Socket.IO clients have disconnected — safe to
    // close the DB pool, flush logs, release leases.
  },
});

Without the bridge, long-lived sockets get a TCP reset on process.exit. With it, they receive a proper disconnect frame.

Full reference

See docs/packages/socket.io.md for the complete API, production checklist, and a chat-with-auth example.

Limitations

  • Must be called BEFORE adapter.listen().
  • One bridge per adapter — use io.of(name) for namespaces.
  • No clustered transport included; use @socket.io/redis-adapter or @socket.io/postgres-adapter for multi-process deployments.
  • Node 18-22 only (uWS prebuilt support; same constraint as @axiomify/native).