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 🙏

© 2024 – Pkg Stats / Ryan Hefner

appeerjs

v1.0.0

Published

A basic encapsulation of Native WebRTC, this would offer an easy to use and understand API for beginners out there

Downloads

15

Readme

AppeerJS

A basic encapsulation of Native WebRTC, this would offer an easy to use and understand API for beginners out there

Getting Started

  1. Go to your project directory using your command line tool then install the project using npm.
npm install appeerjs
  1. Include socket.io and appeer.js to your index page.
<script type="text/javascript" src="socket.io.js"></script>
<script type="text/javascript" src="appeer.min.js"></script>
  1. You need to start the signaling server with the [appeerjs-server] (https://github.com/TMJPEngineering/appeerjs-server).

  2. After finishing the step three you can now connect to AppeerJS.

var appeer = new Appeer('customId', {
  host: 'localhost',
  port: '9000',
  debug: true // Set to true to show console logs and errors, defaults to false
});
  1. Listen to the appeerjs events.
// Triggers when you successfully connects to appeerjs
appeer.on('connection', function (event) {
  var appeerId = event.data.id;
  console.log('My appeer id is', appeerId);
});

// Triggers when the other peers is calling you
appeer.on('call', function (event) {
  var call = event.data.call;
  
  navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
    call.answer(stream); // Answer the call with your stream
  });
});

// Triggers when the remote peer answers the call with a stream
appeer.on('stream', function (event) {
  var stream = event.detail.stream;
  // Do something with the stream
});

// Triggers when a peer connection has been disconnected
appeer.on('close', function (event) {
  var appeerId = event.data.id;
  console.log('User ', peerId, 'has left the call');
});

// Triggers when connecting to appeer fails
appeer.on('error', function (event) {
  var error = event.detail.error;
  // Handle error
});
  1. You can now call to a connected peer, using appeer.call.
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
  appeer.call(appeerId, stream);
});
  1. You can do a conference call by joining a room first
var roomId = '1234';

appeer.join(roomId);
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
  appeer.call(roomId, stream);
});
  1. Disconnect from a connection
var id = '123'; // Either appeer id or room id
apppeer.close(id);

Limitations

Currently WebRTC is not supported in all browsers.
Please see [supported browser versions] (http://caniuse.com/#feat=rtcpeerconnection) for more information on the official support specification.

Inspirations and Motivations

  • [PeerJS] (http://peerjs.com/)

Credits

  • [Socket.io] (http://socket.io/)
  • [EventDispatcher] (https://github.com/mrdoob/eventdispatcher.js/)

License

This project is licensed under the MIT License - see the [LICENSE] (https://github.com/TMJPEngineering/appeerjs/blob/master/LICENSE) file for details

TODO

  • [ ] Unit tests
  • [x] Group conference feature
  • [x] Replace Native Javascript Events with a lightweight Event Library or make a new one
  • [ ] Trigger 'close' event when a single connection user has disconnected unintentionally e.g Page refresh, etc.