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

logora-socketio

v0.2.3

Published

Socketio plugin for Logora – enables real-time communication.

Downloads

14

Readme

logora-socketio

NPM version Coverage Status

logora-socketio is the official Socket.IO output module for the Logora logging framework.

It emits structured Logora instructions through a Socket.IO-compatible emitter, making it easy to forward logs from a Node.js server to connected clients in real time.


Features

  • Structured Socket.IO transport for Logora
  • Output architecture aligned with the Logora ecosystem
  • Supports log, print, title, and empty
  • Keeps transport concerns separated from application logic
  • Uses a lightweight emitter abstraction instead of coupling directly to Socket.IO server types
  • Ships with a default serializer for transport-safe payloads
  • Supports custom event names
  • Non-blocking design compatible with scoped loggers

Installation

npm install logora logora-socketio

Basic Usage

import { createLogger, LogLevel } from "logora";
import { createSocketIoEmitter, createSocketIoOutput } from "logora-socketio";

const io = {
    emit(eventName: string, payload: unknown): void {
        console.log(eventName, payload);
    },
};

const logger = createLogger({ level: LogLevel.Info });

logger.addLogOutput(
    createSocketIoOutput({
        emitter: createSocketIoEmitter(io),
    }),
);

logger.info("Server started on port {0}", 3000);

With Socket.IO Server

import { createServer } from "node:http";
import { Server } from "socket.io";
import { createLogger, LogLevel } from "logora";
import { createSocketIoEmitter, createSocketIoOutput } from "logora-socketio";

const httpServer = createServer();
const io = new Server(httpServer, {
    cors: {
        origin: "*",
    },
});

const logger = createLogger({ level: LogLevel.Info });

logger.addLogOutput(
    createSocketIoOutput({
        emitter: createSocketIoEmitter(io),
        eventName: "logora",
    }),
);

logger.info("Socket.IO server is ready");
logger.print("Listening on port {0}", 3000);

httpServer.listen(3000);

Emitted Payload Format

The package emits structured instructions through the configured Socket.IO event.

Log instruction

{
    kind: "log",
    entry: {
        timestamp: "2026-04-11T12:34:56.000Z",
        type: "info",
        message: "Server started on port {0}",
        args: [3000],
        scope: "http"
    }
}

Print instruction

{
    kind: "print",
    message: "Connected to room {0}",
    args: ["general"]
}

Title instruction

{
    kind: "title",
    title: "Bootstrap"
}

Empty instruction

{
    kind: "empty",
    count: 1
}

Scoped Logging

You can use scoped loggers as usual:

const httpLogger = logger.getScoped("HTTP");
const dbLogger = logger.getScoped("Database");

httpLogger.info("Incoming request: {0}", "/api/users");
dbLogger.error("Query failed: {0}", "Connection timeout");

If a scope is defined, it is included in the serialized log instruction payload.


Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | emitter | SocketIoEmitter | — | The emitter used to dispatch structured instructions | | eventName | string | "logora" | The Socket.IO event name used to emit instructions | | serializer | SocketIoInstructionSerializer | DefaultSocketIoInstructionSerializer | Serializer used to convert log entries and values into transport-safe payloads | | level | LogLevel | inherited from Logora | Minimum log level accepted by this output |


Helper API

createSocketIoOutput(config?)

Creates a Logora output instance configured for Socket.IO transport.

import { createSocketIoOutput } from "logora-socketio";

const output = createSocketIoOutput({
    emitter,
    eventName: "logora",
});

createSocketIoEmitter(target)

Creates a Logora-compatible emitter adapter from any minimal target exposing:

emit(eventName: string, payload: unknown): void;

Example:

import { createSocketIoEmitter } from "logora-socketio";

const emitter = createSocketIoEmitter(io);

This keeps the package lightweight and avoids coupling the public API to specific Socket.IO runtime types.


Notes

  • clear() is intentionally ignored by this output.
  • This package does not create or manage a Socket.IO server.
  • This package does not handle rooms, namespaces, authentication, reconnection, or any application-specific logic.
  • Its responsibility is limited to converting Logora output calls into structured Socket.IO instructions.

License

MIT © Sébastien Bosmans