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

@tombatron/turbo-signalr

v1.0.0-alpha.6

Published

SignalR adapter for Hotwire Turbo Streams - enables real-time DOM updates via ASP.NET Core SignalR

Readme

@tombatron/turbo-signalr

SignalR adapter for Hotwire Turbo Streams. Enables real-time DOM updates via ASP.NET Core SignalR.

Installation

npm

npm install @tombatron/turbo-signalr @microsoft/signalr

CDN

<!-- SignalR (required) -->
<script src="https://cdn.jsdelivr.net/npm/@microsoft/signalr@8/dist/browser/signalr.min.js"></script>

<!-- Turbo SignalR adapter -->
<script src="https://cdn.jsdelivr.net/npm/@tombatron/turbo-signalr/dist/turbo-signalr.js"></script>

NuGet (ASP.NET Core)

If using the Tombatron.Turbo NuGet package, a bundled version is included:

<script src="_content/Tombatron.Turbo/turbo-signalr.bundled.min.js"></script>

Usage

HTML Custom Element

<!-- Subscribe to a stream -->
<turbo-stream-source-signalr
    stream="notifications"
    hub-url="/turbo-hub">
</turbo-stream-source-signalr>

<!-- Target element for updates -->
<div id="notifications"></div>

With Turbo.js (Recommended)

When Turbo.js is loaded, stream messages are automatically rendered:

<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8/dist/turbo.es2017-esm.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@microsoft/signalr@8/dist/browser/signalr.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tombatron/turbo-signalr/dist/turbo-signalr.js"></script>

<turbo-stream-source-signalr stream="my-stream" hub-url="/turbo-hub"></turbo-stream-source-signalr>

Without Turbo.js

The adapter includes a fallback renderer that handles basic Turbo Stream actions when Turbo.js is not present.

Attributes

| Attribute | Required | Default | Description | |-----------|----------|---------|-------------| | stream | Yes | - | Stream name to subscribe to | | hub-url | No | /turbo-hub | SignalR hub URL |

Events

The adapter dispatches events on the document:

| Event | Description | |-------|-------------| | turbo:signalr:connected | Connection established | | turbo:signalr:disconnected | Connection closed | | turbo:signalr:reconnecting | Attempting to reconnect | | turbo:signalr:reconnected | Successfully reconnected | | turbo:signalr:error | Connection error (includes error in detail) |

Element-level events (bubble up):

| Event | Description | |-------|-------------| | turbo:stream:unauthorized | Subscription denied | | turbo:stream:error | Subscription error |

Programmatic API

import { connectionManager, getConnectionState, disconnect } from '@tombatron/turbo-signalr';

// Check connection state
const state = getConnectionState();
console.log(state.isConnected, state.streams);

// Manually disconnect
await disconnect();

Server-Side (ASP.NET Core)

This adapter works with Tombatron.Turbo:

// Broadcast updates to subscribers
await turbo.Stream("notifications", builder =>
{
    builder.Append("notifications", "<div>New message!</div>");
});

Features

  • Singleton Connection: Multiple elements share one SignalR connection
  • Reference Counting: Automatically manages subscriptions
  • Auto-Reconnect: Exponential backoff reconnection with resubscription
  • Turbo.js Integration: Seamless rendering when Turbo is present
  • Fallback Renderer: Works without Turbo.js for basic operations

Browser Support

Works in all modern browsers that support:

  • Custom Elements (Web Components)
  • ES6 Modules
  • WebSocket (or SignalR's fallback transports)

License

MIT