@browser-network/network
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@browser-network/network", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A WebRTC based direct peer to peer network in the browser.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
@@ -17,4 +17,4 @@ # Distributed Browser Network | ||
The Network can be installed via | ||
[npm](npmjs.org/package/@browser-network/network) or | ||
[cdn](unpkg.com/@browser-network/network/umd/network.min.js) and dropped into | ||
[npm](//npmjs.org/package/@browser-network/network) or | ||
[cdn](//unpkg.com/@browser-network/network/umd/network.min.js) and dropped into | ||
any web app and the app will become an interconnected network of all the users | ||
@@ -25,7 +25,7 @@ who currently have the app open. | ||
for writing this was to create a [decentralized database of | ||
sorts](github.com/browser-network/database) to enable truly serverless real | ||
time state updates. This could be used for something like a social network to | ||
great effect. It'd mean no intermediary between users and their data. Each user | ||
does some of the work of saving states and communicating on the network. The | ||
incentive to run the code is to use the app. | ||
sorts](//github.com/browser-network/database) to enable truly serverless real | ||
time state updates on the web. This could be used for something like a social | ||
network to great effect. It'd mean no intermediary between users and their | ||
data. Each user does some of the work of saving states and communicating on the | ||
network. The incentive to run the code is to use the app. | ||
@@ -117,3 +117,3 @@ Really anything that requires real time capabilities will work with this. | ||
However if you do want to run a switching service, a node.js implementation is | ||
available [here](github.com/browser-network/switchboard). | ||
available [here](//github.com/browser-network/switchboard). | ||
@@ -129,3 +129,3 @@ ## Installation | ||
```html | ||
<script src="unpkg.com/@browser-network/network/umd/network.min.js"></script> | ||
<script src="//unpkg.com/@browser-network/network/umd/network.min.js"></script> | ||
``` | ||
@@ -143,5 +143,6 @@ | ||
<body> | ||
<script src="unpkg.com/@browser-network/network/umd/network.min.js"></script> | ||
<script src="//unpkg.com/@browser-network/network/umd/network.min.js"></script> | ||
<script> | ||
const network = new Network({ | ||
const network = window.network = new Network.Network({ | ||
switchAddress: 'http://localhost:5678', // default address of switchboard | ||
@@ -153,2 +154,14 @@ clientId: crypto.randomUUID(), // arbitrary string | ||
network.on('message', console.log) | ||
let counter = 0 | ||
setInterval(() => { | ||
counter += 1 | ||
network.broadcast({ | ||
type: 'amazing-hello-message', | ||
data: 'This is message number ' + counter, | ||
appId: 'my-cool-app-id' | ||
}) | ||
}, 1000) | ||
</script> | ||
@@ -178,3 +191,3 @@ </body> | ||
First up, instaniate a Network. | ||
First up, instantiate a Network. | ||
@@ -181,0 +194,0 @@ ```ts |
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
397687
275