webpeerjs 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
- # WebPEER.js
2
- > Decentralized P2P JS library for communication between applications in browser.
1
+ # WebPEER
2
+ > Decentralized P2P network overlay inside browser
3
3
 
4
4
  [WebPEER.js](https://github.com/nuzulul/webpeerjs) enables browser to browser connectivity without a central server. Build completely peer-to-peer web applications, no trackers or relay servers required. Connecting projects safely, privately, and reliably in WebPEER Network.
5
5
 
6
- [Basic Connection Demo - https://nuzulul.github.io/webpeerjs/demo/](https://nuzulul.github.io/webpeerjs/demo/)
6
+ Basic Connection Demo available at : [https://nuzulul.github.io/webpeerjs/demo/](https://nuzulul.github.io/webpeerjs/demo/)
7
+
8
+ Basic Chat App Demo available at : [https://nuzulul.github.io/webpeerjs/demo/chat.html](https://nuzulul.github.io/webpeerjs/demo/chat.html)
7
9
 
8
10
  ## Security
9
11
 
@@ -57,13 +59,13 @@ void async function main() {
57
59
 
58
60
  console.log(`My node id : ${node.id}`)
59
61
 
60
- const [broadcast,listen,members] = node.joinRoom('globalroom')
62
+ const [broadcast,listen,onmembersupdate] = node.joinRoom('globalroom')
61
63
 
62
64
  listen((message,id) => {
63
65
  console.log(`Message from ${id} : ${message}`)
64
66
  })
65
67
 
66
- members((data) => {
68
+ onmembersupdate((data) => {
67
69
  console.log(`Members : ${data}`)
68
70
  broadcast('hello')
69
71
  })
@@ -75,11 +77,14 @@ void async function main() {
75
77
 
76
78
  - `createWebpeer(config)` - Create a new node.
77
79
  - `config` - Configuration object contain:
78
- - `rtcConfiguration` - **(optional)** Custom [rtcConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection) for WebRTC transport, the only transport available for direct peer-to-peer connectivity between browser.
79
- - `id` - The unique ID of the node as an identity in the global network.
80
+ - `rtcConfiguration` - **(optional)** Custom [rtcConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection) for WebRTC transport, currently the only transport available for direct peer-to-peer connectivity between browser.
81
+ - `id` - Get the unique ID of the node as an identity in the global network.
80
82
  - `status` - Get the node status, returns `connected` or `unconnected`.
81
83
  - `peers` - Get all connected peers.
82
84
  - `joinRoom(namespace)` - Join to the room, returns an array of three functions (Broadcaster, onListenBroadcast, onMembersUpdate).
85
+ - `Broadcaster` - Function to broadcast message to room members (limited to 1 message/second).
86
+ - `onListenBroadcast` - Callback function that listen on incoming broadcast message.
87
+ - `onMembersUpdate` - Callback function that listen on room members update.
83
88
 
84
89
  ## API Docs
85
90