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

@telemetryos/sdk-bridge

v1.22.1

Published

The official TelemetryOS SDK bridge package. Provides the Bridge class and message protocol for host environments to communicate with TelemetryOS applications.

Readme

@telemetryos/sdk-bridge

The postMessage communication layer between platform host environments and TelemetryOS SDK applications running in iframes.

Who This Is For

This package is for platform host developers — the teams building Player-Program, Manager-UI, Studio-UI, and Application-SDK-Program. These host environments embed TelemetryOS applications as iframes and need to send/receive messages with them.

App developers don't use this package directly. The @telemetryos/sdk and @telemetryos/root-sdk packages provide the app-side Client class that communicates with the Bridge automatically.

How It Fits Together

Host environment (Player-Program, Studio-UI, etc.)
  └── Bridge (this package) — listens for ClientMessages, sends BridgeMessages
        ↕ postMessage
  └── iframe: TelemetryOS application
        └── Client (@telemetryos/root-sdk) — sends ClientMessages, listens for BridgeMessages

Installation

npm install @telemetryos/sdk-bridge

Usage

import { Bridge } from '@telemetryos/sdk-bridge'
import type { ClientMessage, BridgeMessage } from '@telemetryos/sdk-bridge'

const bridge = new Bridge()

// Handle messages from SDK applications
bridge.onMessage = (message: ClientMessage) => {
  console.log(`${message.name} from ${message.applicationSpecifier}`)

  // Respond to the application
  if (message.responseName) {
    bridge.send({
      name: message.responseName,
      data: { /* response payload */ },
    })
  }
}

// Start listening for messages
bridge.bind()

// Broadcast a message to all embedded applications
bridge.send({
  name: 'store.valueChanged',
  data: { key: 'theme', value: 'dark' },
})

// Stop listening when done
bridge.unbind()

API

Bridge

| Method | Description | |--------|-------------| | bind() | Attaches a message event listener to the window. Incoming messages are validated against the ClientMessage schema and passed to onMessage. | | unbind() | Removes the event listener. | | send(message: BridgeMessage) | Broadcasts a message to every window.frames[i] via postMessage. | | onMessage?: (message: ClientMessage) => void | Callback invoked when a valid ClientMessage is received from an iframe. |

Message Types

ClientMessage — sent from SDK applications to the host:

| Field | Type | Description | |-------|------|-------------| | telemetrySdkVersion | string | SDK version of the sending application | | applicationSpecifier | string | Unique identifier for the application version | | applicationInstance | string | Instance ID (from URL query params) | | runtime | 'window' \| 'worker' | Execution context of the sender | | name | string | Message type (e.g. store.getValue) | | data | any | Payload | | responseName? | string | Name the host should use when responding | | subscriptionName? | string | Name for ongoing subscription updates | | unsubscribeName? | string | Name to cancel a subscription |

BridgeMessage — sent from the host to SDK applications:

| Field | Type | Description | |-------|------|-------------| | name | string | Message type | | data | any | Payload |

Validators and Formatters

| Export | Description | |--------|-------------| | clientMessageValidator | Zod schema for validating incoming ClientMessage objects | | bridgeMessageValidator | Zod schema for validating BridgeMessage objects | | formatClientMessage(data) | Adds type: 'client' to a ClientMessage for postMessage | | formatBridgeMessage(data) | Adds type: 'bridge' to a BridgeMessage for postMessage |

Key Behaviors

  • Zod validation: Incoming messages are parsed with clientMessageValidator.safeParse(). Invalid messages are silently ignored (defensive against browser noise).
  • Version mismatch warnings: If a message looks like a ClientMessage (has type: 'client' or known fields) but fails validation, a console warning is logged to help diagnose SDK version mismatches.
  • Broadcast: send() posts to all window.frames — individual SDK clients filter for messages relevant to them.
  • Self-filtering: Messages from the host's own window (event.source === window) are ignored to prevent loops.