Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Dynamic communication flows between message based actors.
Babble makes it easy to code communication flows between actors. A conversation
is modeled as a control flow diagram containing blocks listen
, ask
, tell
,
reply
, decide
, and run
. Each block can link to a next block in the
control flow. Conversations are dynamic: a scenario is build programmatically,
and the blocks can dynamically determine the next block in the scenario.
Babble uses pubsub to communicate between actors. It comes with built in support to communicate locally, and has as support for pubnub to connect actors distributed over multiple devices.
Babble runs in node.js and in the browser.
Install babble via npm:
npm install babble
Load in node.js:
var babble = require('babble');
Load in the browser:
<!DOCTYPE html>
<html>
<head>
<!-- load pubnub, only needed when using pubnub -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/pubnub/3.5.4/pubnub.min.js"></script>
<!-- load babble -->
<script src="../../dist/babble.min.js"></script>
</head>
<body>
</body>
</html>
Then babble can be loaded and used:
var babble = require('babble');
var emma = babble.babbler('emma').subscribe(),
jack = babble.babbler('jack').subscribe();
emma.listen('ask age', babble.reply(function () {
return 25;
}));
jack.ask('emma', 'ask age', babble.run(function (age) {
console.log(this.from + ' is ' + age + ' years old');
}));
Babble can be used to listen for messages and send a reply. In the following example, emma listens for two messages: "ask age" and "tell age". In the first case she will reply telling her age, in the second case she just outputs the received age. Jack first tells his age, and then asks emma's age, waits for her to reply, and then output the received age.
This scenario can be represented by the following control flow diagram:
The scenario is programmed as:
var babble = require('babble'),
babbler = babble.babbler,
reply = babble.reply,
run = babble.run;
var emma = babbler('emma').subscribe(),
jack = babbler('jack').subscribe();
emma.listen('ask age', reply(function () {
return 25;
}));
emma.listen('tell age', run(function (age) {
console.log(this.from + ' is ' + age + ' years old');
}));
jack.tell('emma', 'tell age', 27);
jack.ask('emma', 'ask age', run(function (age) {
console.log(this.from + ' is ' + age + ' years old');
}));
The following scenario describes two peers planning a meeting in two steps: First jack asks whether emma has time for a meeting, and if so, jack will propose to meet, and await emma's response.
This scenario can be represented by the following control flow diagram:
The scenario is coded as:
var babble = require('babble'),
babbler = babble.babbler,
reply = babble.reply,
run = babble.run,
decide = babble.decide;
var emma = babbler('emma').subscribe(),
jack = babbler('jack').subscribe();
emma.listen('do you have time today?', decide(function (response) {
if (Math.random() > 0.4) {
return reply(function () {
return 'yes';
}, decide(function (response) {
if (response == 'can we meet at 15:00?' && Math.random() > 0.5) {
return reply(function () {
return 'ok';
});
}
else {
return reply(function () {
return 'no';
})
}
}));
}
else {
return reply(function () {
return 'no';
});
}
})
);
jack.ask('emma', 'do you have time today?', decide(function (response) {
if (response == 'yes') {
return reply(function () {
return 'can we meet at 15:00?';
}, decide(function (response) {
if (response == 'ok') {
return run(function () {
console.log('emma agreed');
});
}
else {
return run(function () {
console.log('emma didn\'t agree');
});
}
}));
}
else {
return run(function () {
console.log('emma has no time');
});
}
}));
TODO: describe API
Babble can be build for use in the browser. This is done using the tools browserify and uglify. First install all project dependencies:
npm install
To build the library ./dist/babble.js
, run:
npm run build
To build and minify the library ./dist/babble.min.js
, run:
npm run minify
To execute tests for the library, install the project dependencies once:
npm install
Then, the tests can be executed:
npm test
2014-01-02, version 0.3.0
FAQs
Dynamic communication flows between message based actors.
The npm package babble receives a total of 13 weekly downloads. As such, babble popularity was classified as not popular.
We found that babble demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.