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

libnice

v0.1.6

Published

A thin wrapper around the ICE library libnice

Downloads

36

Readme

node-libnice

What is this?

This is a thin node.js wrapper around libnice. It provides ICE (Interactive Connectivity Establishment) support, which is a protocol for NAT traversal. ICE is primarily used in peer-to-peer applications like VoIP, video conferences, and instant messaging. It is part of SIP and WebRTC.

Setup

You have to make sure that you have libnice >=1.4 and its headers are installed. On Debian/Ubuntu/... run

apt-get install libnice-dev

Then install this library with

npm install libnice

Usage

First you have to create an agent which can create streams

var agent = new require("libnice").NiceAgent();
agent.setStunServer("132.177.123.6");

An important concept in libnice are components. A stream can consist of multiple components which are something like channels. Each component can send and receive data. To create a stream with one component call

var stream = agent.createStream(1);

Streams are EventEmitters. Register your callbacks

stream.on('gatheringDone', function(candidates) {
    // candidates is an array of sdp strings
    var credentials = stream.getLocalCredentials();
    // send credentials and candidates to remote client
});

stream.on('stateChanged', function(component, state) {
	// state is a string
}

stream.on('receive', function(component, data) {
    // data is a buffer
});

Please note that the first parameter on stateChanged and receive is the component id. Component ids are numbers starting from 1.

To start the connection process tell the stream to gather candidates

stream.gatherCandidates();

Now you have to exchange the credentials and ice candidates with the other client

stream.setRemoteCredentials(ufrag, pwd);
stream.addRemoteCandidate(candidate1);
stream.addRemoteCandidate(candidate2);

When everything is set up and the clients are able to connect to each other you should arrive in the state ready. Now you can now send and receive data

stream.send(component, data)

Full API documentation will be added shortly. Please also consult the libnice documentation for detailed information.

TODOs

  • more documentation
  • resolve host for stun servers
  • port missing libnice functions
  • get rid of the glib loop in its own thread