Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/montyanderson/scatternet
A lightweight peer-to-peer network framework.
https://github.com/montyanderson/scatternet
javascript network node nodejs p2p socket udp
Last synced: 6 days ago
JSON representation
A lightweight peer-to-peer network framework.
- Host: GitHub
- URL: https://github.com/montyanderson/scatternet
- Owner: montyanderson
- License: mit
- Created: 2017-09-13T13:09:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-01T12:00:51.000Z (over 7 years ago)
- Last Synced: 2024-11-17T05:24:02.986Z (2 months ago)
- Topics: javascript, network, node, nodejs, p2p, socket, udp
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scatternet
A lightweight peer-to-peer network framework.
## Decentralised chat appliction example
``` javascript
const { Node } = require("scatternet");const node = new Node("simplechat");
node.directory(6000, "public-directory-example.net");
node.listen();node.on("message", ({ peer, msg }) => {
process.stdout.write(`\r${peer} - ${msg}`);
process.stdout.write("- ");
});node.on("peer", peer => {
process.stdout.write(`\r${peer} joined the chat!\n`);
process.stdout.write("- ");
});process.stdout.write("- ");
process.stdin.on("readable", () => {
const chunk = process.stdin.read();if(chunk) {
process.stdout.write("- ");
node.broadcast(chunk);
}
});
```