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

socket-p2p-singnaling

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket-p2p-singnaling

Server middleware to power socket.io-p2p. Handles signalling.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Socket.io-p2p-server

The socket.io middleware that powers socket.io-p2p. It handles passing signalling data between all peers. Just include the middleware and everything is handled for you.

How to use

Simple require the module and use it.

var p2pserver = require('socket.io-p2p-server').Server
var io = require('socket.io')(server);
io.use(p2pserver)

For example, in an express powered app, you can do the following:

var app = require('express')()
var server = require('http').Server(app)
var p2pserver = require('socket.io-p2p-server').Server
var io = require('socket.io')(server)

app.use(express.static(__dirname))
io.use(p2pserver)

server.listen(3030, function () {
  console.log("Listening on 3030")
})

It can also be used inside your connection logic so that you can specify a room that clients will communicate over:

p2pserver(socket, null, room)

Note that null must be passed as the second arguement when being used in this context.

Keywords

FAQs

Package last updated on 17 Feb 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

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