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

react-adonis-transmit

v1.0.1

Published

React context and hooks for Adonis Transmit

Readme

React Adonis Transmit

🚀 Seamless Server-Sent Events integration for React applications using AdonisJS Transmit.

npm version License: MIT Stars NPM CI

✨ Features

  • 🔌 Zero-config setup with AdonisJS Transmit
  • 🎯 Simple and intuitive React hooks API
  • 🔄 Automatic connection management and reconnection
  • 🧮 Smart subscription handling with reference counting
  • 🔒 Simple authentication handling
  • 📝 Built-in logging for easy debugging
  • 📦 Tiny footprint (~3KB gzipped)
  • 💪 Written in TypeScript with full type support
  • 🧪 Thoroughly tested with Jest and React Testing Library

🚀 Installation

npm install react-adonis-transmit

🎯 Quick Start

  1. Wrap your app with the TransmitProvider:
import { TransmitProvider } from 'react-adonis-transmit'

function App() {
  return (
    <TransmitProvider 
      baseUrl="http://your-api-url"
      // Optional: Add auth header
      authHeader="Bearer your-token-here"
      // Optional: Handle messages globally
      onMessage={(channel, event) => {
        console.log(`Message from ${channel}:`, event)
      }}
      // Optional: Enable debug logging
      enableLogging={true}
    >
      {/* Your app components */}
    </TransmitProvider>
  )
}
  1. Subscribe to channels with our simple hook:
import { useTransmit } from 'react-adonis-transmit'

function MyComponent() {
  const { subscribe } = useTransmit()

  useEffect(() => {
    // Subscribe to real-time updates
    const unsubscribe = subscribe('my-channel', (event) => {
      console.log('Received event:', event)
    })

    // Auto-cleanup on unmount
    return () => unsubscribe()
  }, [])

  return <div>My Component</div>
}

🛠 Configuration Options

TransmitProvider Props

| Prop | Type | Description | |------|------|-------------| | baseUrl | string | Required. Base URL of your Adonis API | | authHeader | string | Authorization header value (e.g. "Bearer token") | | onMessage | (channel, event) => void | Global message handler | | enableLogging | boolean | Enable debug logging |

🌟 Why React Adonis Transmit?

  • Simple Integration: Get real-time updates in your React app with just a few lines of code
  • Smart Memory Management: Automatic cleanup of unused subscriptions
  • Production Ready: Built with performance and reliability in mind
  • Developer Friendly: Comprehensive TypeScript support and debugging tools

🤝 Contributing

We welcome contributions! Feel free to:

  • Open issues for bugs or feature requests
  • Submit pull requests
  • Improve documentation

📦 Release Process

To release a new version:

  1. Make sure you have GitHub CLI installed (brew install gh on macOS)
  2. Login to GitHub CLI: gh auth login
  3. Run one of the following commands:
    # Create a custom version release
    npm run release 1.2.3
    
    # Or use semantic versioning shortcuts
    npm run release:patch  # 0.0.x
    npm run release:minor  # 0.x.0
    npm run release:major  # x.0.0

The release process will:

  • Check for uncommitted changes
  • Update version in package.json
  • Create and push git tag
  • Create GitHub release with auto-generated notes
  • Trigger CI/CD pipeline to:
    • Run tests across Node.js 18.x and 20.x
    • Build the package
    • Publish to npm (on release only)

Note: Make sure you have the NPM_TOKEN secret set in your GitHub repository settings for automatic npm publishing.

📝 License

MIT © Alexis Faure

🧪 Testing

The library is thoroughly tested using Jest and React Testing Library. Tests cover:

  • Provider initialization
  • Authentication handling
  • Subscription lifecycle
  • Multiple subscriptions to the same channel
  • Error cases
  • Logging functionality

To run the tests:

# Run tests once
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Coverage thresholds are set to 80% for:

  • Branches
  • Functions
  • Lines
  • Statements