webpeerjs 0.0.7 → 0.0.9

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,11 +1,31 @@
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 with [IPFS](https://ipfs.tech/). Build completely P2P web applications, no trackers or relay servers required.
3
3
 
4
4
  WebpeerJS enables browser to browser connectivity without a central server.
5
5
 
6
- [Demo](https://nuzulul.github.io/webpeerjs/demo/)
6
+ [Live Demo](https://nuzulul.github.io/webpeerjs/demo/)
7
7
 
8
- ## Example
8
+ ## Features
9
+
10
+ * ✅ Decentralized Network
11
+ * ✅ Broadcast Message
12
+ * ✅ Works in The Browser
13
+
14
+ ## Install
15
+
16
+ NPM :
17
+
18
+ ```
19
+ npm i webpeerjs
20
+ ```
21
+
22
+ Browser `<script>` tag :
23
+
24
+ ```
25
+ <script src="https://cdn.jsdelivr.net/npm/webpeerjs@0.0/dist/umd/webpeerjs.min.js"></script>
26
+ ```
27
+
28
+ ## Usage
9
29
 
10
30
  ```
11
31
  import { webpeerjs } from 'webpeerjs'
@@ -16,7 +36,7 @@ void async function main() {
16
36
 
17
37
  console.log(`My node id : ${node.id}`)
18
38
 
19
- const [send,listen,members] = node.joinRoom('myroom')
39
+ const [broadcast,listen,members] = node.joinRoom('myroom')
20
40
 
21
41
  listen((message,id) => {
22
42
  console.log(`Message from ${id} : ${message}`)
@@ -24,35 +44,35 @@ void async function main() {
24
44
 
25
45
  members((data) => {
26
46
  console.log(`Members : ${data}`)
27
- send('hello')
47
+ broadcast('hello')
28
48
  })
29
49
 
30
50
  }()
31
51
  ```
32
52
 
33
- ## Install
53
+ ## API
34
54
 
35
- NPM :
55
+ - `createWebpeer()` Create a new node.
56
+ - `id` The unique ID of the node as an identity in the global network.
57
+ - `status` Get the node status, returns `connected` or `unconnected`.
58
+ - `peers` Get all connected peers.
59
+ - `joinRoom(namespace)` Join to the room, returns an array of three functions (Broadcaster, onListenBroadcast, onMembersUpdate).
36
60
 
37
- ```
38
- npm i webpeerjs
39
- ```
61
+ ## API Docs
40
62
 
41
- CDN :
63
+ [https://nuzulul.github.io/webpeerjs](https://nuzulul.github.io/webpeerjs)
42
64
 
43
- ```
44
- <script src="https://cdn.jsdelivr.net/npm/webpeerjs@0.0/dist/umd/webpeerjs.min.js"></script>
45
- ```
65
+ ## Related
46
66
 
47
- ## API
48
-
49
- - `createWebpeer()` Create a new local node.
50
- - `id` The unique ID of the local node as an identity in the global network.
51
- - `joinRoom()` Adding a local node to the room, returns an array of three functions (Sender, onListen, onMembers).
52
- - `peers` Get all connected peers.
67
+ - [simple-peer](https://github.com/feross/simple-peer) - Simple WebRTC video, voice, and data channels.
68
+ - [peerjs](https://github.com/peers/peerjs) - Simple peer-to-peer with WebRTC.
69
+ - [trystero](https://github.com/dmotz/trystero) - Build instant multiplayer webapps, no server required.
53
70
 
54
71
  ## License
55
72
 
56
- MIT License
73
+ MIT
74
+
75
+ ## Maintainers
76
+
77
+ [Nuzulul Zulkarnain](https://github.com/nuzulul)
57
78
 
58
- Copyright (c) 2024 [Nuzulul Zulkarnain](https://github.com/nuzulul)
@@ -2,15 +2,16 @@ export class webpeerjs {
2
2
  static createWebpeer(): Promise<webpeerjs>;
3
3
  constructor(libp2p: any, dbstore: any, onMetrics: any);
4
4
  id: any;
5
- status: any;
5
+ status: string;
6
6
  IPFS: {
7
7
  libp2p: any;
8
8
  discoveredPeers: Map<any, any>;
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
  }