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

@freeasin/rtc-connect

v0.2.1

Published

Initiate and manage RTC connections

Downloads

10

Readme

RTC Connection

A WebRTC peer connection module

Caveats

  • Data channel only - at the moment
  • Handling signaling to create the connection is up to you. Signaling values come from Peer.onGeneratedHandshake(handshake).
    • The included test app provides signaling via in-page text boxes whose values can be shared with another host

Getting Started

npm install @freeasin/rtc-connection

import { Peer } from "@freeasin/rtc-connection;

  1. Turn off console logging with logToConsole in the constructor
    • new Peer({ logToConsole: false })
  2. Set the default outbound channel name with defaultDataChannel in the constructor
    • new Peer({ defaultDataChannel: "myChannel" })
  3. Add additional outbound channels with Peer.dataChannel.AddOutboundChannel(channelName)
  4. On Peer.onGeneratedHandshake(handshake), provide the handshake value to the opposite host
  5. Provide a handler for inbound messages
    • Peer.dataChannel.AddInboundMessageHandler(dataChannelLabel, (evt) => void)
    • evt.data contains the message
  6. Handle Peer.dataChannel.outbound.get("CHANNEL_NAME").onOpen to manage your application when a data channel opens between hosts
    • (evt) => {}
    • evt.target will be the channel
    • channel.readyState should be "open"
    • This is where the UX indicate connections between hosts now exists
  7. Use Peer.onStateChanged(handler) to define handlers that will be called on every state change for the peer connection

Included Example

  1. Run the test app
npm run test
  1. Go to http://localhost:8080
  2. Click the Add Peer Connection button at the bottom
    • You now have two idential sections on the page
  3. Click one of the Generate Offer buttons
    • The handshake signal shown is automatically copied to the clipboard
  4. Paste into the other Consume Offer box, and click the Consume Offer button
    • You'll get an alert if you try to paste a handshake signal into the same section that generates it
  5. Continue pasting/clicking back-and-forth until the two peer connections agree on how to connect
  6. Once the connection is negotiated, the UI changes to "Send" boxes, and you have a peer-to-peer messaging app
    • The typing notification is sent over a different data channel from the messages

Try the same example in two different browser tabs instead of two connections on one page

This also works over different devices locally, or over the Internet, as long as you can exchange the handshake signaling data

License

MIT

See LICENSE for further details.