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

sigmasockets-types

v1.0.16

Published

Shared TypeScript type definitions for SigmaSockets

Readme

@sigmasockets/types

Shared TypeScript type definitions for the SigmaSockets WebSocket system.

Installation

npm install @sigmasockets/types

Usage

Import All Types

import type {
  ConnectionStatus,
  Message,
  SigmaSocketClient,
  SigmaSocketServer,
  SigmaSocketError,
} from '@sigmasockets/types';

Import Specific Type Categories

// Common types
import type { ConnectionStatus, Message } from '@sigmasockets/types/common';

// Client types
import type { SigmaSocketClient, ClientEvents } from '@sigmasockets/types/client';

// Server types
import type { SigmaSocketServer, ServerEvents } from '@sigmasockets/types/server';

Type Categories

Common Types (/common)

Core types shared between client and server:

  • ConnectionStatus - Connection state enumeration
  • Message - WebSocket message types
  • ClientSession - Client session information
  • ConnectionConfig - Connection configuration
  • ServerConfig - Server configuration
  • SigmaSocketError - Custom error class
  • ErrorCode - Error code enumeration

Client Types (/client)

Client-specific types:

  • SigmaSocketClient - Main client interface
  • SigmaSocketClientConfig - Client configuration
  • ClientEvents - Client event types
  • ClientPlugin - Plugin interface
  • ClientMiddleware - Middleware interface
  • ClientBuilder - Builder pattern interface

Server Types (/server)

Server-specific types:

  • SigmaSocketServer - Main server interface
  • SigmaSocketServerConfig - Server configuration
  • ServerEvents - Server event types
  • ServerPlugin - Plugin interface
  • ServerMiddleware - Middleware interface
  • ServerBuilder - Builder pattern interface

Examples

Client Usage

import type { SigmaSocketClient, ConnectionStatus } from '@sigmasockets/types';

const client: SigmaSocketClient = new SigmaSocketClient({
  url: 'ws://localhost:8080',
  reconnectInterval: 1000,
  maxReconnectAttempts: 10,
});

client.on('connection', (status: ConnectionStatus) => {
  console.log('Connection status:', status);
});

Server Usage

import type { SigmaSocketServer, Message } from '@sigmasockets/types';

const server: SigmaSocketServer = new SigmaSocketServer({
  port: 8080,
  heartbeatInterval: 30000,
});

server.on('message', (clientId: string, message: Message) => {
  console.log('Received message from', clientId, ':', message);
});

Error Handling

import type { SigmaSocketError, ErrorCode } from '@sigmasockets/types';

try {
  // Some SigmaSockets operation
} catch (error) {
  if (error instanceof SigmaSocketError) {
    switch (error.code) {
      case ErrorCode.ConnectionFailed:
        console.error('Connection failed:', error.message);
        break;
      case ErrorCode.AuthenticationFailed:
        console.error('Authentication failed:', error.message);
        break;
      default:
        console.error('SigmaSocket error:', error.message);
    }
  }
}

Type Safety Features

Strict Type Checking

All types are designed with strict TypeScript in mind:

  • No any types in public APIs
  • Comprehensive error handling types
  • Immutable interfaces where appropriate
  • Proper generic constraints

IntelliSense Support

Full IntelliSense support for:

  • Method signatures
  • Property types
  • Event callbacks
  • Configuration options
  • Error codes and messages

Compile-Time Validation

Type definitions provide compile-time validation for:

  • Configuration objects
  • Event handlers
  • Message structures
  • Error handling
  • Plugin interfaces

Version Compatibility

This package follows semantic versioning:

  • Major version: Breaking changes to type definitions
  • Minor version: New types or non-breaking additions
  • Patch version: Bug fixes and documentation updates

Contributing

When adding new types:

  1. Follow the existing naming conventions
  2. Add comprehensive JSDoc comments
  3. Include examples in documentation
  4. Update this README if needed
  5. Ensure backward compatibility

License

MIT