Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
A callback style DDP (Meteor's Distributed Data Protocol) node client.
Based heavily on alansikora's node-js_ddp-client, and meteor's python client. Uses a more callback style approach.
The client implements the pre1 version of DDP. It is unfinished at this point, but should do most of what you want it to do.
npm install ddp
Please see the example in examples/example.js
. Or here for reference:
var DDPClient = require("ddp");
var ddpclient = new DDPClient({
host: "localhost",
port: 3000,
/* optional: */
auto_reconnect: true,
auto_reconnect_timer: 500
});
ddpclient.connect(function(error) {
if (error) {
console.log('DDP connection error!');
return;
}
console.log('connected!');
ddpclient.call('test-function', ['foo', 'bar'], function(err, result) {
console.log('called function, result: ' + result);
})
ddpclient.subscribe('posts', [], function() {
console.log('posts complete:');
console.log(ddpclient.collections.posts);
})
});
/*
* Useful for debugging and learning the ddp protocol
*/
ddpclient.on('message', function(msg) {
console.log("ddp message: " + msg);
});
/*
* If you need to do something specific on close or errors.
* (You can also disable auto_reconnect and call ddpclient.connect()
* when you are ready to re-connect.)
*/
ddpclient.on('socket-close', function(code, message) {
console.log("Close: %s %s", code, message);
});
ddpclient.on('socket-error', function(error) {
console.log("Error: %j", error);
});
Many thanks to Alan Sikora for the ddp-client which formed the inspiration for this code.
Contributions:
FAQs
Node.js module to connect to servers using DDP protocol.
We found that ddp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.