webrtc-explorer
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "webrtc-explorer", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Chord inspired ring DHT algorithm using WebRTC as transport layer for P2P in the browser", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -22,3 +22,3 @@ webrtc-explorer | ||
## Create a new peer | ||
### Create a new peer | ||
@@ -38,32 +38,49 @@ ``` | ||
## Register the peer | ||
### Register the peer | ||
``` | ||
peer.events.on('registered', function(data){ | ||
// peer registered with data.peerId | ||
}); | ||
peer.register(); | ||
``` | ||
## Send and receive a message | ||
### Send and receive a message | ||
peerIds are 48 bits represented in a string using hex format. To send, in one peer: | ||
``` | ||
var data = 'hey peer, how is it going'; | ||
peer.send('abcd0f0fdbca', data); | ||
``` | ||
## Other options | ||
To receive, in another peer (responsible for that Id) | ||
### logging | ||
``` | ||
peer.events.on('message', function(envelope){ | ||
// message from the other peer envelope.data | ||
}); | ||
``` | ||
### Other options | ||
#### logging | ||
add the logging flag to your config | ||
``` | ||
var config = { | ||
``` | ||
var config = { | ||
//... | ||
logging: true | ||
//... | ||
}; | ||
``` | ||
}; | ||
``` | ||
# How does it work | ||
Read the CHORD paper | ||
Some important learnings that are part of webrtc-explorer, were done in webrtc-ring | ||
http://blog.daviddias.me/2014/12/20/webrtc-ring | ||
To understand fully webrtc-explorer's core, it is crucial to be familiar with the [Chord][chord-paper]. webrtc-explorer levarages important battle experience from building webrtc-ring - http://blog.daviddias.me/2014/12/20/webrtc-ring | ||
* I'll upload my notes and images `soon`, I'm trying to make them as legible as possible. If you have a urgency in one of the parts, please let me know, so that I put that one as a priority. | ||
## Registering a peer | ||
@@ -76,2 +93,8 @@ | ||
## Message routing | ||
[chord-paper]: http://pdos.csail.mit.edu/papers/chord:sigcomm01/chord_sigcomm.pdf |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22615
98