Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-peer

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-peer

Automatic peer connection

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

auto-peer.js Build Status Dependency Status Built with Grunt

Abstract

auto-peer.js automates the peer.js connection establishment and connects all auto-peer.js clients with each other using webRTC.

The auto-peer.js library is an experimental webRTC client/server library which relies heavily on peerjs and socket.io

Motivation

The idea auto-peer.js was developed when creating a multi media installation for a couple of tablets. It should allow to communicate from tablet to tablet as fast as possible.

http://engineering.spilgames.com/mastering-webrtc/ from http://engineering.spilgames.com/mastering-webrtc/

How does it work?

auto-peer.js core consists of a node websocket backend and a client side script. When the user opens the application a new client is created. This client asks the backend to tell all existing clients to establish a new webRTC connection.

Example

Take a look at the example directory.

Server

var app = require('express')();
var http = require('http').Server(app);
var autoPeer = require('auto-peer')(http);

app.get('/', function (req, res) {
  res.sendFile(__dirname + '/index.html');
});

http.listen(3000, function () {
  console.log('listening on *:3000');
});

Client

<script src="/auto-peer.min.js"></script>
<script>
  // Please get your own free key at http://peerjs.com/
  var autoPeer = new AutoPeer({key: 'lwjd5qra8257b9'});
  autoPeer.on('example-message', function(data){
    console.log('received data', data);
  });
  autoPeer.send('example-message', 'This is a message to all connected peers');
</script>

Events

Client

  • autoPeer:connected
  • autoPeer:data

Server

  • autoPeer:newClient

Security

auto-peer.js is an experimental library and was not meant to be used in productive environment. As a client is able to send commands to any other client you should never evaluate html or javascript code transmitted by auto-peer.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

License

Copyright (c) 2014 Jan Nicklas. Licensed under the MIT license.

FAQs

Package last updated on 02 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc