ran3d / foglet-core Goto Github PK
View Code? Open in Web Editor NEWEasy use of WebRTC Networks with embedded network management and simple communication primitives
License: MIT License
Easy use of WebRTC Networks with embedded network management and simple communication primitives
License: MIT License
Currently, if I want to use unicast with Foglet, I need to use Chat-Wane Unicast module and plug it to the Spray network inside the Foglet. It could me nice to have access to methods in Foglet API to perform unicast send/receive on a Hight level API.
A little use case:
const foglet = new Foglet(options);
// init & connection ....
// send to a peer using unicast
const peerId = getIdOfRandomNeighbour();
foglet.unicast('hello w/ unicast', peerId);
// send using broadcast
foglet.broadcast('hello w/ boradcast');
// receive from unicast
// id = id of the peer who send the message, i.e. the sender
// message = The message received
foglet.onUnicast((id, message) => {
console.log('message ' + message + ' from peer @' + id);
});
// receive from broadcast
// message = The message received
foglet.onBroadcast(message => {
console.log('broadcast message ' + message);
});
A function to get a list of neighbour's ids could be useful when sending using unicast
const ids = foglet.getPeers();
console.log(ids);
// could print: [ '@id1', '@id2', '@id3']
foglet.unicast('hello deer friend', ids[0]);
A proper release needs a proper documentation
onBroadcast
for example)FBroadcast
for example)Cause of the growing number of tests. Tests become very huge and heavy to run on browsers due to the number of WebRTC connections on the same page.
Karma is working on a parallel solution to run parallel tests but meanwhile we reach test problems with the growing number of webRTC connections.
My idea to minimize the number of foglets loaded during tests and minimize the number of webrtc connection is to load a fixed number of foglets before tests and ONLY use them for testing purposes.
Think this would be a good idea to work like this.
Another solution is to split tests and apply each karma-test on each file in order to have a single page by test file and minimize the number of webrtc connection by pages.
This leads to problems:
Need to quickly find a solution.
If someone has a better idea, comment here.
Currently, tests only cover on pratical use cases and a lot of possible errors and unwanted behaviours are left aside.
Time to fix this ! ๐ฏ
In a dream world, let's try to hit 100% code coverage ๐
Add a warning when we are in HTTPs domains if signaling or ssh server are in HTTP. Vice versa.
The first implementation is obselete and need to be rebuilt:
Using streamBroadcast() function in Communication, if we sent two distinct streams successively, they are causally dependent by default, since, by default, FIFO broadcast is used in the class Broadcast.
fix by removing fcn-wrtc in package.json
Hi,
Not sure if this project is inactive, because its not updated for almost years, if this is the case its sad because its really cool project.
Anyway I run the project on the browser and its great, but I really would like to have nodes running on node, I know that project uses webrtc but now that is a the https://github.com/node-webrtc/node-webrtc (I have tested with simple-peer) and it works fine.
I am not sure if it would be possible to use it with this project, I tried to look at the code but I didn't figure out how I could do it.
Thanks.
Cause of the non-existence of _log function, need to remove this listener.
Tempory fix if you have this error: foglet._ssh.removeAllListeners('logs')
Broadcasting a message to a subset of the network will not work. Each peer has to register a common Communication in order to route messages.
If you create the following network
new Foglet({rps: { options: {delta: 10000000, a: 0, b: 0 }}})
)If you really want to broadcast a message to a subset of the network. Just register a common protocol and filter messages in your application. Or create a new Foglet for this specific subset network with new WebRTC connections.
Hi,
I am experimenting doing a p2p queue (https://github.com/fsvieira/p2pqueue) its still on proof-of-concept phase, I still need to work on stats.
I have a question, can I send a message from node A to node Z, if they are not neighbors something like this,
A -> B -> ... -> X, Z , where B ... X nodes that connect A to Z, how this works on foglet-core ?
Another question is that I am getting same node but with suffix -I and -O, from what I understand they are the same but some are out view and in view, the problem is that I get both when I call getNeighbours(limit), for example If I have only two nodes, and request a limit=4 I get same id with id-I and id-O , I would like to get only one id because when I send a message to all the neighbors on the list I am duplicating messages sent. Or is this feature ? If network changes they will still be able to send message ?
Another question, I saw this https://ran3d.github.io/foglet-core/class/src/fprotocol/answer-queue.js~AnswerQueue.html on the docs but I don't understand it, what is it for and how to use it ?
An issue that I had following the docs was using the floget-scripts, it doenst work because signal server version is to old. So I had to install "foglet-signaling-server": "^1.0.3" directly.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.