webpeerjs 0.0.8 → 0.0.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,14 +1,16 @@
1
1
  # WebpeerJS
2
- > Simple peer-to-peer with [IPFS](https://ipfs.tech/). Build completely P2P web applications, no trackers or relay servers involved.
2
+ > Simple peer-to-peer in the browser.
3
3
 
4
- WebpeerJS enables browser to browser connectivity without a central server.
4
+ Build completely P2P web applications, no trackers or relay servers required. [WebpeerJS](https://github.com/nuzulul/webpeerjs) enables browser to browser connectivity without a central server. Connecting people safely, privately, openly and reliably.
5
5
 
6
6
  [Live Demo](https://nuzulul.github.io/webpeerjs/demo/)
7
7
 
8
8
  ## Features
9
9
 
10
10
  * ✅ Decentralized Network
11
- * ✅ Broadcast Message
11
+ * ✅ Unlimited Peers
12
+ * ✅ Works in The Browser
13
+ * ✅ Broadcast Message / Room
12
14
 
13
15
  ## Install
14
16
 
@@ -18,7 +20,9 @@ NPM :
18
20
  npm i webpeerjs
19
21
  ```
20
22
 
21
- CDN :
23
+ Browser `<script>` tag :
24
+
25
+ Uses built-in JS files from [latest release](https://github.com/nuzulul/webpeerjs/releases/latest) or [CDN](https://www.jsdelivr.com/package/npm/webpeerjs) will make it's exports available as `webpeerjs` in the global namespace.
22
26
 
23
27
  ```
24
28
  <script src="https://cdn.jsdelivr.net/npm/webpeerjs@0.0/dist/umd/webpeerjs.min.js"></script>
@@ -35,7 +39,7 @@ void async function main() {
35
39
 
36
40
  console.log(`My node id : ${node.id}`)
37
41
 
38
- const [broadcast,listen,members] = node.joinRoom('myroom')
42
+ const [broadcast,listen,members] = node.joinRoom('globalroom')
39
43
 
40
44
  listen((message,id) => {
41
45
  console.log(`Message from ${id} : ${message}`)
@@ -53,9 +57,13 @@ void async function main() {
53
57
 
54
58
  - `createWebpeer()` Create a new node.
55
59
  - `id` The unique ID of the node as an identity in the global network.
56
- - `joinRoom()` Adding the node to the room, returns an array of three functions (Broadcaster, onListenMessage, onMembersUpdate).
57
- - `peers` Get all connected peers.
58
60
  - `status` Get the node status, returns `connected` or `unconnected`.
61
+ - `peers` Get all connected peers.
62
+ - `joinRoom(namespace)` Join to the room, returns an array of three functions (Broadcaster, onListenBroadcast, onMembersUpdate).
63
+
64
+ ## API Docs
65
+
66
+ [https://nuzulul.github.io/webpeerjs](https://nuzulul.github.io/webpeerjs)
59
67
 
60
68
  ## Related
61
69
 
@@ -63,6 +71,11 @@ void async function main() {
63
71
  - [peerjs](https://github.com/peers/peerjs) - Simple peer-to-peer with WebRTC.
64
72
  - [trystero](https://github.com/dmotz/trystero) - Build instant multiplayer webapps, no server required.
65
73
 
74
+ ## License
75
+
76
+ MIT
77
+
66
78
  ## Maintainers
67
79
 
68
- [Nuzulul Zulkarnain](https://github.com/nuzulul)
80
+ [Nuzulul Zulkarnain](https://github.com/nuzulul)
81
+
@@ -9,8 +9,9 @@ export class webpeerjs {
9
9
  };
10
10
  address: any[];
11
11
  peers: any[];
12
- onJoin: (f: any) => any;
13
- onLeave: (f: any) => any;
12
+ onConnect: (f: any) => any;
13
+ onDisconnect: (f: any) => any;
14
14
  joinRoom: (room: any) => any[];
15
+ dial(addr: any): void;
15
16
  #private;
16
17
  }