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

@effectstream/event-client

v0.101.1

Published

MQTT-based event client for EffectStream

Readme

@effectstream/event-client

MQTT-based event subscriber for EffectStream. Subscribe to type-safe events streamed by the engine and the batcher - blocks, transactions, primitive events, and any app-defined event - without writing raw MQTT topic strings.

  • MQTT subscriber for Effectstream events: blocks, transactions, primitives, app-defined.
  • Type-safe topics; no raw topic strings.
  • Connects to the broker run by @effectstream/event-server (or any MQTT broker).
  • Bun caveat: the mqtt WebSocket transport isn't supported on Bun yet; use Node for programmatic consumption.

Install

bun add @effectstream/event-client
# or
npm install @effectstream/event-client

Standalone usage

You need a reachable MQTT broker. EffectStream's engine and batcher run brokers (default ports 8883 and 8884 over WebSocket); point at one of those, or your own.

import {
  BuiltinEvents,
  EventManager,
} from "@effectstream/event-client";

const sub = await EventManager.Instance.subscribe(
  {
    topic: BuiltinEvents.RollupBlock,
    filter: {},        // no path variables on this topic
  },
  ({ rollup, msTimestamp }) => {
    console.log("new rollup block", rollup, "at", msTimestamp);
  },
);

// Later: EventManager.Instance.unsubscribe(sub);

subscribe returns a symbol you can pass to unsubscribe. For events that encode variables in the topic path (e.g. block/${blockHeight}), pass filter: { blockHeight } to subscribe only to a specific value, or filter: { blockHeight: "*" } to subscribe to all.

Inside EffectStream

The client half of the engine/batcher event system. The engine publishes block, transaction, and primitive events to its MQTT broker; the batcher publishes its own lifecycle events. Frontends and tools (like @effectstream/wallets, the explorer, and the batcher itself) subscribe through this package; the runtime publishes via the matching @effectstream/event-server.

The most-imported symbols from this package are EventManager and BuiltinEvents. (getEvmEvent, often paired with these in state-machine primitives, lives in @effectstream/config - not here.)

Bun caveat: the mqtt package's WebSocket transport isn't supported on Bun yet. Use Node (or a TCP MQTT broker) when consuming events programmatically; the engine's exposed WebSocket transport is for browsers.

Key exports

Heavily used across the repo:

  • EventManager - singleton with .subscribe, .subscribeExplicit, .unsubscribe, .sendMessage, .sendMessageExplicit. Use EventManager.Instance.
  • BuiltinEvents - pre-baked typed event definitions for RollupBlock, SyncChains, batcher BatcherHash, etc. Pass these into EventManager.Instance.subscribe(...).
  • toSignature(event) - "name(type1,type2,...)" string for a typed event.

Types you'll see in callback signatures: CallbackArgs<E>, CallbackAndMetadata<E>, EventPathAndDef, LogEvent, RegisteredEvent.

Also exported: EventConnect, EventBrokerNames, TopicPrefix, registerEvents, groupEvents, encodeEventForStf, toSignatureHash.

Examples

Runnable: test/examples.test.ts.

Links

  • Docs: https://effectstream.github.io/docs/packages/sdk/event-client
  • Source: https://github.com/effectstream/effectstream/tree/main/packages/effectstream-sdk/events