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

@hieco/realtime-react

v1.0.0

Published

React hooks for @hieco/realtime with automatic subscription management

Readme

@hieco/realtime-react

@hieco/realtime-react brings Hieco’s realtime relay client into React with a provider, hooks, and managed connection state.

It is the easiest way to add live Hedera updates to a React app without hand-rolling websocket orchestration.

Why This Package Exists

Realtime React code gets messy fast when connection state, subscriptions, and cleanup all live in components. This package gives you:

  • a RealtimeProvider
  • shared client and connection state
  • hooks for relay subscriptions
  • an easier bridge between static reads and live updates

When To Use It

Choose @hieco/realtime-react when you are building:

  • live transaction feeds
  • streaming dashboards
  • React apps that combine initial Mirror reads with realtime updates
  • components that should subscribe and unsubscribe cleanly with the tree

Installation

npm install @hieco/realtime @hieco/realtime-react
pnpm add @hieco/realtime @hieco/realtime-react
yarn add @hieco/realtime @hieco/realtime-react
bun add @hieco/realtime @hieco/realtime-react

Peer dependencies expected from the host app:

  • react >= 18
  • react-dom >= 18

Quick Start

import { useEffect } from "react";
import {
  RealtimeProvider,
  useContractLogs,
  useRealtimeContext,
  useStreamState,
} from "@hieco/realtime-react";

function ContractLogFeed() {
  const { connect } = useRealtimeContext();
  const streamState = useStreamState();
  const { logs, isConnected, error } = useContractLogs({
    address: "0x0000000000000000000000000000000000001389",
    enabled: true,
  });

  useEffect(() => {
    void connect();
  }, [connect]);

  if (!isConnected) return <div>{streamState._tag}</div>;
  if (error) return <div>{error.message}</div>;

  return <pre>{JSON.stringify(logs, null, 2)}</pre>;
}

export function App() {
  return (
    <RealtimeProvider
      config={{
        network: "testnet",
        relayEndpoint: "wss://testnet.mirrornode.hedera.com/relay/ws",
      }}
    >
      <ContractLogFeed />
    </RealtimeProvider>
  );
}

The Provider Model

RealtimeProvider owns:

  • the active relay client
  • the current stream state
  • connect()
  • disconnect()

That makes realtime connectivity feel like shared app infrastructure instead of one more local component concern.

The provider does not auto-connect by itself. Call connect() from useRealtimeContext() when the app is ready to open the relay connection.

Useful Hooks

Common exports include:

  • useRealtimeClient()
  • useStreamState()
  • useChainId()
  • useContractLogs()

Use the provider and hooks first. Drop to the raw client only when you need manual subscription logic.

Related Packages