New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-peerjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-peerjs

PeerJS server component

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

node-peerjs

Version

PeerServer helps broker connections between PeerJS clients.

Create server:

var peer = require('node-peerjs').PeerServer()
		.on('connection', console.log.bind(console, 'connection'))
		.on('disconnect', console.log.bind(console, 'disconnect'));

Connecting to the server from PeerJS:

<script src='http://localhost:8008/peerjs/lib.js'></script>
<script>var peer = new Peer().on('open', console.log.bind(console, 'open'));</script>

If you prefer to use a cloud hosted PeerServer instead of running your own:

new Peer('IdUser', {host: 'peerjs.com', port: 9000})

Create room

var room = Peer.Room('IdRoom', {name: 'User 1'})
		.on('server', console.log.bind(console, 'server'))
		.on('data', console.log.bind(console, 'data'))
		.on('join', console.log.bind(console, 'join'))
		.on('left', console.log.bind(console, 'left'))
		.on('list', console.log.bind(console, 'list'))
		.on('error', console.error.bind(console, 'error'));

Send data to peer(s)

peer.send('data');
room.send('data' [, id ]);

Fetch

Peer.Fetch('https://api.qwedl.com/ip.php', {
    init: {
        secure: true,
        host: '0.peerjs.com',
        port: 443
    }
}).then(res => {
    console.log(res);
    res.json().then(console.log.bind(console));
});

Config nginx proxy:

location /peerjs {
	proxy_pass http://127.0.0.1:8008;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
}

Debug

http://localhost:8008/debug

Installation

npm install -g node-peerjs

FAQs

Package last updated on 16 May 2020

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