ddp-micro

1.0.1 • Public • Published

Meteor DDP server, supporting Meteor-style reactive subscriptions and methods. Implemented in a small efficient way.

Create DDP Server

var DDP = new DDPServer({port:3000});

Create Subscriptions

Subscriptions are not backed by Mongo documents. You can create fully custom subscriptions. Internally the data structure is a hash object where the keys are the _id's and the values are the values:

var Files = server.publish('Files');
Files.id1 = {name:'swiggity-swooty.mp4'};
Files.id2 = {name:'coming-for-that-booty.mp4'};

When you set or remove a property of Files, it will send the appropriate message over DDP.

Methods

Methods are invoked with the arguments supplied by the connected client and a node-style callback. To return a value, invoke the callback.

DDP.methods({
    test(value, callback) {
        callback(null, value)
    }
});

Add DDP to an existing HTTP server

var app = express();
app.server = http.createServer(app);
var server = new DDPServer({httpServer: app.server});

Package Sidebar

Install

npm i ddp-micro

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • jamesloper