All Projects → geut → Discovery Swarm Webrtc

geut / Discovery Swarm Webrtc

Licence: mit
discovery-swarm for WebRTC

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Discovery Swarm Webrtc

Libcrtc
WebRTC C++ library built on top of chromium webrtc.
Stars: ✭ 89 (+58.93%)
Mutual labels:  webrtc, p2p, peer
Hlsjs P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 759 (+1255.36%)
Mutual labels:  webrtc, p2p, peer
P2p Media Loader
An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
Stars: ✭ 822 (+1367.86%)
Mutual labels:  webrtc, p2p, peer
P2p Cdn Sdk Javascript
Free p2p cdn github javascript sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 158 (+182.14%)
Mutual labels:  webrtc, p2p, peer
Android P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 70 (+25%)
Mutual labels:  webrtc, p2p, peer
Ios P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 31 (-44.64%)
Mutual labels:  webrtc, p2p, peer
Webtorrent
⚡️ Streaming torrent client for the web
Stars: ✭ 25,554 (+45532.14%)
Mutual labels:  webrtc, p2p
Simple Peer
📡 Simple WebRTC video, voice, and data channels
Stars: ✭ 5,923 (+10476.79%)
Mutual labels:  webrtc, p2p
Briefing
Secure direct video group chat
Stars: ✭ 710 (+1167.86%)
Mutual labels:  webrtc, peer
P
Peer-to-peer networking with browsers
Stars: ✭ 400 (+614.29%)
Mutual labels:  webrtc, p2p
Webrtc android
webrtc VideoCall VideoConference 视频通话 视频会议
Stars: ✭ 764 (+1264.29%)
Mutual labels:  webrtc, p2p
Lnbook
Mastering the Lightning Network (LN)
Stars: ✭ 931 (+1562.5%)
Mutual labels:  p2p, peer
Pearplayer.js
支持WebRTC的多源多协议混合P2P-CDN的流媒体播放器
Stars: ✭ 512 (+814.29%)
Mutual labels:  webrtc, p2p
Fluence
Peer-to-peer computing protocol and licensing system
Stars: ✭ 453 (+708.93%)
Mutual labels:  p2p, peer
Webtorrent Cli
WebTorrent, the streaming torrent client. For the command line.
Stars: ✭ 633 (+1030.36%)
Mutual labels:  webrtc, p2p
Swarm
swarm docs
Stars: ✭ 403 (+619.64%)
Mutual labels:  p2p, swarm
Waggle.js
An experiment to distribute the bandwidth among video viewers
Stars: ✭ 29 (-48.21%)
Mutual labels:  webrtc, p2p
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+14898.21%)
Mutual labels:  webrtc, p2p
Viraljs
Express.JS middleware to enable P2P distribution for your app. Your decentralized CDN made easy.
Stars: ✭ 952 (+1600%)
Mutual labels:  webrtc, p2p
Nicotine Plus
Nicotine+: A graphical client for the SoulSeek peer-to-peer system
Stars: ✭ 310 (+453.57%)
Mutual labels:  p2p, peer

discovery-swarm-webrtc

Build Status JavaScript Style Guide

discovery-swarm for webrtc

force-graph

This module provides a "similar" API to discovery-swarm but for WebRTC connections.

It has a few differences to discovery-swarm:

  • It needs a signaling server. We give you one.
  • It uses mmst to minimize the connections. Check the example.
  • join and leave only accepts Buffers.
  • leave and close accepts a callback argument or returns a Promise.

Install

$ npm install @geut/discovery-swarm-webrtc

Usage

Server

You can run your own signal server by running:

$ discovery-swarm-webrtc --port=4000

Public Servers

  • wss://geut-webrtc-signal-v3.glitch.me
  • wss://geut-webrtc-signal-v3.herokuapp.com

Deploy to Heroku

Deploy

Client

const crypto = require('crypto')
const swarm = require('@geut/discovery-swarm-webrtc')

const sw = swarm({
  bootstrap: ['ws://localhost:4000']
})

const topic = crypto.createHash('sha256')
  .update('my-discovery-swarm-topic')
  .digest()

sw.join(topic)

sw.on('connection', peer => {
  // connected
})

API

const sw = swarm(opts)

Creates a new Swarm.

opts include:

{
  id: crypto.randomBytes(32), // peer-id for user
  bootstrap: [string], // urls to your websocket endpoints
  stream: (info) => stream, // stream to replicate across peers
  simplePeer: {}, // options for the simplePeer instances,
  maxPeers: 5, // max connections by peer
  timeout: 15 * 1000, // defines the time to wait to establish a connection
}

sw.join(Buffer)

Join a specific channel. We use behind it simple-signal + simple-peer.

const promise = sw.leave(Buffer)

Leave from specific channel. Destroy all the connections and leave the channel.

const promise = sw.close([callback])

Close the entire swarm. Destroy all the connections and disconnect from the signal.

const arrayOfPeers = sw.getPeers([channel])

Returns the list of connected peers for a specific channel.

Channel is optional, if you don't pass it you get the entire list of peers.

sw.connect(channel: Buffer, peerId: Buffer) -> Promise<SimplePeer>

Connect directly to a specific peer.

Events

sw.on('handshaking', function(connection, info) { ... })

Emitted when you've connected to a peer and are now initializing the connection's session. Info is an object that contains information about the connection.

info include:

{
  id: Buffer // the remote peer's peer-id.
  channel: Buffer // the channel this connection was initiated on.
  initiator: Boolean // whether we initiated the connection or someone else did
}

sw.on('connection', function(connection, info) { ... })

Emitted when you have fully connected to another peer. Info is an object that contains info about the connection.

sw.on('connection-closed', function(connection, info) { ... })

Emitted when you've disconnected from a peer. Info is an object that contains info about the connection.

sw.on('leave', function(channel) { ... })

Emitted when you left a channel.

sw.on('close', function() { ... })

Emitted when the swarm was closed.

sw.on('candidates-updated', function(channel, candidates) { ... })

Emitted when the candidates peer for a specific channel was updated. candidates is an array of Buffer id.

Issues

🐛 If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.

Contributing

👥 Ideas and contributions to the project are welcome. You must follow this guideline.

Sponsored By

DXOS

License

MIT © A GEUT project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].