webpeerjs 0.0.9 → 0.1.0
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 +15 -18
- package/dist/esm/webpeerjs.js +250 -171
- package/dist/umd/webpeerjs.js +50738 -47615
- package/package.json +5 -1
- package/src/config.js +49 -9
- package/src/peer.js +2 -5
- package/src/webpeerjs.js +159 -113
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# WebpeerJS
|
|
2
|
-
> Simple peer-to-peer
|
|
2
|
+
> Simple peer-to-peer communication between applications in 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. Let's create a next generation internet that is fair, free and open.
|
|
5
5
|
|
|
6
|
-
[
|
|
6
|
+
[Basic Connection Demo](https://nuzulul.github.io/webpeerjs/demo/)
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
|
-
* ✅ Decentralized
|
|
10
|
+
* ✅ Decentralized P2P
|
|
11
|
+
* ✅ Unlimited Peers
|
|
12
|
+
* ✅ Works in Browsers
|
|
11
13
|
* ✅ Broadcast Message
|
|
12
|
-
* ✅ Works in The Browser
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
@@ -21,8 +22,10 @@ npm i webpeerjs
|
|
|
21
22
|
|
|
22
23
|
Browser `<script>` tag :
|
|
23
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.
|
|
26
|
+
|
|
24
27
|
```
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/webpeerjs@0.
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/webpeerjs@0.1/dist/umd/webpeerjs.min.js"></script>
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
## Usage
|
|
@@ -36,7 +39,7 @@ void async function main() {
|
|
|
36
39
|
|
|
37
40
|
console.log(`My node id : ${node.id}`)
|
|
38
41
|
|
|
39
|
-
const [broadcast,listen,members] = node.joinRoom('
|
|
42
|
+
const [broadcast,listen,members] = node.joinRoom('globalroom')
|
|
40
43
|
|
|
41
44
|
listen((message,id) => {
|
|
42
45
|
console.log(`Message from ${id} : ${message}`)
|
|
@@ -52,22 +55,16 @@ void async function main() {
|
|
|
52
55
|
|
|
53
56
|
## API
|
|
54
57
|
|
|
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).
|
|
58
|
+
- `createWebpeer()` - Create a new node.
|
|
59
|
+
- `id` - The unique ID of the node as an identity in the global network.
|
|
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).
|
|
60
63
|
|
|
61
64
|
## API Docs
|
|
62
65
|
|
|
63
66
|
[https://nuzulul.github.io/webpeerjs](https://nuzulul.github.io/webpeerjs)
|
|
64
67
|
|
|
65
|
-
## Related
|
|
66
|
-
|
|
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.
|
|
70
|
-
|
|
71
68
|
## License
|
|
72
69
|
|
|
73
70
|
MIT
|