All Projects → feross → P2p Graph

feross / P2p Graph

Licence: mit
Real-time P2P network visualization with D3

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to P2p Graph

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 (+235.51%)
Mutual labels:  p2p, webtorrent, peer
Torrent Discovery
Discover BitTorrent and WebTorrent peers
Stars: ✭ 177 (-27.76%)
Mutual labels:  p2p, webtorrent, peer
Dawn
global hosting, financial automation, server-less web components
Stars: ✭ 40 (-83.67%)
Mutual labels:  network, p2p, webtorrent
Vue D3 Network
Vue component to graph networks using d3-force
Stars: ✭ 415 (+69.39%)
Mutual labels:  graph, network, d3
Bittorrent Dht
🕸 Simple, robust, BitTorrent DHT implementation
Stars: ✭ 1,004 (+309.8%)
Mutual labels:  p2p, webtorrent, peer
Programming Languages Influence
Code to retrieve data for the programming languages influence visualizations from Freebase
Stars: ✭ 171 (-30.2%)
Mutual labels:  graph, network
Txeh
Go library and CLI utilty for /etc/hosts management.
Stars: ✭ 181 (-26.12%)
Mutual labels:  network, networking
Scaproust
Implementation of the nanomsg "Scalability Protocols" in rust.
Stars: ✭ 183 (-25.31%)
Mutual labels:  network, networking
Appnet.link
Secure P2P HTTP Gateway as Tunnel Protocol
Stars: ✭ 203 (-17.14%)
Mutual labels:  p2p, peer
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-33.06%)
Mutual labels:  network, networking
Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Stars: ✭ 15,172 (+6092.65%)
Mutual labels:  graph, p2p
Enet
⚡️ ENet reliable UDP networking library
Stars: ✭ 202 (-17.55%)
Mutual labels:  network, networking
Medium
Independent telecommunication environment
Stars: ✭ 171 (-30.2%)
Mutual labels:  network, networking
Torrentpier
Main project repository
Stars: ✭ 166 (-32.24%)
Mutual labels:  p2p, webtorrent
Spitfire
An easy to use WebRTC Datachannels library for .NET applications.
Stars: ✭ 164 (-33.06%)
Mutual labels:  networking, p2p
V Chart Plugin
Easily bind a chart to the data stored in your Vue.js components.
Stars: ✭ 188 (-23.27%)
Mutual labels:  graph, d3
Newnode
NewNode decentralized Content Distribution Network
Stars: ✭ 223 (-8.98%)
Mutual labels:  network, p2p
Golden Gate
Framework to connect wearables and other IoT devices to mobile phones, tablets and PCs with an IP-based protocol stack over Bluetooth Low Energy
Stars: ✭ 223 (-8.98%)
Mutual labels:  network, networking
Fire
🔥A delightful HTTP/HTTPS networking framework for iOS/macOS/watchOS/tvOS platforms written in Swift.
Stars: ✭ 243 (-0.82%)
Mutual labels:  network, networking
Ipfs Pubsub Room
IPFS Pubsub room
Stars: ✭ 229 (-6.53%)
Mutual labels:  p2p, peer

p2p-graph travis npm downloads javascript style guide

Real-time P2P network visualization with D3

demo

This package is used by WebTorrent. You can see this package in action on the webtorrent.io homepage or play with it on the esnextb.in demo.

Install

npm install p2p-graph

This package works in the browser with browserify. If you do not use a bundler, you can use the standalone script directly in a <script> tag.

Usage

var Graph = require('p2p-graph')

var graph = new Graph('.root')

graph.on('select', function (id) {
  console.log(id + ' selected!')
})

// Add two peers
graph.add({
  id: 'peer1',
  me: true,
  name: 'You'
})
graph.add({
  id: 'peer2',
  name: 'Another Peer'
})

// Connect them
graph.connect('peer1', 'peer2')

API

Heads Up! : Represented Graphs are directed!

In graph theory, a directed graph (or digraph) is a graph that is a set of vertices connected by edges, where the edges have a direction associated with them.

graph = new Graph(rootElem)

Create a new P2P graph at the root DOM element rootElem. In addition to an Element, a query selector string (like '.my-cool-element') can also be passed in.

graph.add(peer)

Add a peer to the graph. The peer object should contain:

{
  id: 'unique-identifier', // should be unique across all peers
  me: true, // is this the current user?
  name: 'display name' // name to show in the graph UI
}

graph.connect(id1, id2)

Connect to two nodes, identified by id1 and id2, to each other.

graph.disconnect(id1, id2)

Disconnect two nodes, identified by id1 and id2, from each other.

graph.areConnected(id1, id2)

Check whether two nodes identified by id1 and id2 are somehow connected (id1 --> id2 or id2 --> id1).

graph.getLink(id1, id2)

If exists return the link between id1 and id2, otherwise null.

graph.hasPeer(Id1[, ...IdX])

Return true if all the given Nodes exists, otherwise false.

graph.hasLink(Id1, Id2)

Return true the given Link exists, otherwise false (direction matters!).

graph.remove(id)

Remove a node, identified by id, from the graph.

graph.seed(id, isSeeding)

Change a node's status identified by id, isSeeding must be true or false.

graph.rate(id1, id2, speed)

Update the transfer rate between two nodes identified by id1 and id2. speed must be expressed in bytes.

graph.list()

Return an array of Nodes.

graph.destroy()

Destroys the graph and all the listeners related to it.

graph.on('select', function (id) {})

Event is fired when a node is selected (clicked on) by the user. The id argument is either the id of the selected peer, false to indicate that the peer has been deselected. Only one peer can be selected at any given time.

license

MIT. Copyright (c) Feross Aboukhadijeh.

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].