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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sucoza/websocket-signalr-devtools-plugin

v0.1.9

Published

DevTools plugin for WebSocket and SignalR connection monitoring and debugging

Readme

WebSocket & SignalR DevTools Plugin

A comprehensive DevTools plugin for monitoring and debugging WebSocket and SignalR connections in real-time. Built following TanStack DevTools patterns and architecture.

Features

🔌 WebSocket Monitoring

  • Real-time Connection Tracking - Monitor WebSocket connections as they're created, opened, and closed
  • Message Inspection - View sent/received messages with JSON and binary data support
  • Connection State Monitoring - Track connection states (CONNECTING, OPEN, CLOSING, CLOSED)
  • Protocol Support - Handle custom WebSocket protocols and extensions
  • Error Tracking - Capture and display connection and message errors

📡 SignalR Monitoring

  • Hub Connection Tracking - Monitor SignalR hub connections and their lifecycle
  • Method Invocation Monitoring - Track hub method calls with arguments and results
  • Transport Layer Visibility - See which transport is being used (WebSockets, SSE, Long Polling)
  • Automatic Reconnection Tracking - Monitor reconnection attempts and strategies
  • Streaming Support - Track streaming invocations and their data flow
  • Hub Method Statistics - Performance metrics for each hub method

📊 Performance Monitoring

  • Real-time Metrics - Connection counts, message rates, data transfer rates
  • Interactive Charts - Message activity, bytes transferred, connection states over time
  • Hub Method Performance - Execution times, invocation counts, error rates
  • Connection Health - Error rates, reconnection patterns, uptime tracking

🔍 Advanced Debugging

  • Message Filtering - Filter by connection, message type, time range, content
  • Search Functionality - Full-text search across all messages and data
  • Export Capabilities - Export data as JSON, CSV, or HAR format
  • Connection Simulation - Test connections with simulated data (coming soon)

🎨 Developer Experience

  • Responsive UI - Works great on all screen sizes
  • Dark/Light Theme - Automatic theme detection with manual override
  • Keyboard Shortcuts - Quick actions for common tasks
  • Real-time Updates - No polling - everything updates instantly
  • Zero Configuration - Works out of the box with any WebSocket/SignalR app

Installation

npm install @sucoza/websocket-signalr-devtools-plugin

Quick Start

Basic Usage

import React from 'react';
import { WebSocketSignalRDevToolsPanel } from '@sucoza/websocket-signalr-devtools-plugin';

function App() {
  return (
    <div>
      <h1>My Application</h1>
      
      {/* Your app content */}
      <MyWebSocketApp />
      
      {/* DevTools Panel */}
      <WebSocketSignalRDevToolsPanel height={600} />
    </div>
  );
}

Advanced Configuration

import React from 'react';
import { 
  WebSocketSignalRDevToolsPanel,
  createWebSocketSignalRDevToolsClient 
} from '@sucoza/websocket-signalr-devtools-plugin';

function App() {
  const client = React.useMemo(() => 
    createWebSocketSignalRDevToolsClient(), []
  );

  return (
    <div>
      <WebSocketSignalRDevToolsPanel 
        height={800}
        theme="dark"
        className="my-devtools"
      />
    </div>
  );
}

Programmatic Control

import { createWebSocketSignalRDevToolsClient } from '@sucoza/websocket-signalr-devtools-plugin';

const client = createWebSocketSignalRDevToolsClient();

// Control recording
client.toggleWebSocketRecording();
client.toggleSignalRRecording();

// Clear data
client.clearWebSocketData();
client.clearSignalRData();

// Force close connections
client.closeConnection('websocket', 'connection-id');
client.closeConnection('signalr', 'hub-connection-id');

// Access state
const state = client.getState();
console.log('WebSocket connections:', state.websocket.connections.size);
console.log('SignalR connections:', state.signalr.connections.size);

How It Works

The plugin uses JavaScript proxying to intercept WebSocket constructor calls and SignalR hub connection creations. This allows it to:

  1. Monitor WebSocket connections by wrapping the native WebSocket constructor
  2. Track SignalR connections by intercepting HubConnectionBuilder.build() calls
  3. Capture all network traffic without modifying your application code
  4. Provide real-time updates through an event-driven architecture
  5. Maintain connection state even when DevTools is opened/closed

Interception Details

  • WebSocket: Proxies the global WebSocket constructor
  • SignalR: Intercepts HubConnectionBuilder instances and wraps connection methods
  • Zero Impact: No performance impact on your application
  • Framework Agnostic: Works with any JavaScript framework or vanilla JS

API Reference

WebSocketSignalRDevToolsPanel Props

interface WebSocketSignalRDevToolsPanelProps {
  height?: number;           // Panel height in pixels (default: 600)
  className?: string;        // Additional CSS classes
  theme?: 'light' | 'dark' | 'auto'; // Theme preference (default: 'auto')
}

Client Methods

interface WebSocketSignalRDevToolsClient {
  // Recording control
  toggleWebSocketRecording(): void;
  toggleSignalRRecording(): void;
  
  // Data management  
  clearWebSocketData(): void;
  clearSignalRData(): void;
  
  // Connection control
  closeConnection(type: 'websocket' | 'signalr', id: string): void;
  
  // State access
  getState(): DevToolsState;
  
  // UI control
  selectTab(tab: 'websocket' | 'signalr' | 'performance'): void;
  selectConnection(id?: string): void;
  selectMessage(id?: string): void;
  toggleFilters(): void;
  setTheme(theme: 'light' | 'dark' | 'auto'): void;
}

Examples

Check out the example applications:

  • WebSocket Example: example/websocket-app/ - Demonstrates WebSocket connection monitoring
  • SignalR Example: example/signalr-app/ - Shows SignalR hub connection tracking

To run the examples:

# WebSocket example
cd example/websocket-app
npm install
npm run dev

# SignalR example  
cd example/signalr-app
npm install
npm run dev

Architecture

The plugin follows TanStack DevTools patterns:

┌─────────────────────────┐
│   React UI Components   │
├─────────────────────────┤
│   DevTools Store        │  ← useSyncExternalStore
├─────────────────────────┤
│   Event Client          │  ← TanStack DevTools integration
├─────────────────────────┤
│   Interceptors          │  ← WebSocket/SignalR proxying
└─────────────────────────┘
  • UI Components: React components for the DevTools interface
  • Store: Centralized state management with external store pattern
  • Event Client: TanStack DevTools integration layer
  • Interceptors: Network interception and monitoring

Browser Support

  • Chrome/Edge: Full support
  • Firefox: Full support
  • Safari: Full support
  • Mobile: Responsive design works on mobile browsers

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

# Clone the repository
git clone https://github.com/tanstack/websocket-signalr-devtools.git
cd websocket-signalr-devtools

# Install dependencies
npm install

# Start development
npm run dev

# Run tests
npm run test

# Build for production
npm run build

License

MIT


Part of the @sucoza TanStack DevTools ecosystem.

Changelog

See CHANGELOG.md for version history and updates.