New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babble

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babble - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

examples/guess_the_number.js

11

package.json
{
"name": "babble",
"version": "0.0.1",
"description": "Conversations over pubsub. Tell, ask, reply",
"version": "0.1.0",
"description": "Distributed conversations over pubsub. Tell, ask, reply",
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",

@@ -11,4 +11,9 @@ "keywords": [

],
"repository": {
"type": "git",
"url": "git://github.com/josdejong/babble.git"
},
"dependencies": {
"pubsub-js": "~1.4.0"
"pubsub-js": "~1.4.0",
"node-uuid": "~1.4.1"
},

@@ -15,0 +20,0 @@ "devDependencies": {

@@ -1,4 +0,83 @@

babble
======
# Babble
Conversations over pubsub. Tell, ask, reply.
Distributed conversations over pubsub. Tell, ask, reply.
Babble makes it easy to create dynamic communication flows between peers.
## Usage
Install babble via npm:
npm install babble
Example usage:
### Simple request/response
```js
var babble = require('../index');
var emma = babble.babbler('emma'),
jack = babble.babbler('jack');
emma.listen('ask age', function () {
this.reply(25);
});
emma.listen('tell age', function (age) {
console.log(this.from + ' is ' + age + ' years old');
});
jack.tell('emma', 'tell age', 27);
jack.ask('emma', 'ask age', function (age) {
console.log(this.from + ' is ' + age + ' years old');
});
```
### Conversation with multiple replies
```js
var babble = require('babble');
var emma = babble.babbler('emma'),
jack = babble.babbler('jack');
emma.listen('How are you doing?', function () {
if (Math.random() > 0.2) {
this.reply('great');
}
else {
this.reply('not good', function (response) {
if (response == 'Why?') {
this.reply('I got my nose smashed in against the wall');
}
});
}
});
jack.ask('emma', 'How are you doing?', function (response) {
if (response == 'mwa') {
if (Math.random() > 0.5) {
this.reply('Why?', function (response) {
// etc...
});
}
else {
this.reply('Come, give me a hug');
}
}
});
```
## Test
To execute tests for the library, install the project dependencies once:
npm install
Then, the tests can be executed:
npm test
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc