To convince my Q42 colleagues to add DDP APIs alongside their REST APIs, I created DDP-Server-Reactive, which allows you to add DDP server functionality to your NodeJS app with almost no effort:
// Create a server listening on the default port 3000
var server = new DDPServer();
// Create a reactive collection
// All the changes below will automatically be sent to subscribers
var todoList = server.publish("todolist");
// Add items
todoList[0] = { title: "Cook dinner", done: false };
todoList[1] = { title: "Water the plants", done: true };
// Change items
todoList[0].done = true;
// Remove items
delete todoList[1];
// Add methods
server.methods({
test: function() {
return true;
}
});
DDP servers (not clients) are notoriously hard to build because there’s no spec anywhere. So props for putting this together and for making sure it’s really easy to use! Very Meteoric of you.
@sjoerdvisscher Sjoerd, did you actually convince your colleagues and what happened to your effort? Still care to build something from it? I am interested because our project would be a perfect fit. Heavy real time data, almost no persistence requirements… we just want to avoid using mongodb as a bottleneck. So we’re probably going for the classic way now, but in the future we might put ourselves on the implementation task as well.
@jhohlfeld I think most colleagues see the value of DDP now. But I don’t think anyone is using my library, it turns out that just using Meteor is the better solution most of the time.
@rgoomar@rahul@sjoerdvisscher@benjick@jhohlfeld
Hi guys, I build a web service REST API from meteor and the client is native
android java. I wanna upload file from my android using rest or ddp. but
until now, i havent found the solution about uploading file via ddp or
using rest. Anybody wants to help me?
Uploading a file “using REST” shouldn’t be any different than uploading a file on any other platform. I imagine you’d just POST the file to the endpoint. Where are you getting stuck?
I was just looking for alternatives to Meteor on server side and found this… It’s pretty lightweight, not tested, and not much added over the fork it came from, but it can probably get me off the ground well enough to get some benchmarks. It’s a real shame MDG didn’t a) elevate the DDP spec to something more than an afterthought (how about a decent documentation site for example?) b) provide node reference implementations for client and server. Asteroid for the client is doing pretty well, but I’m still evaluating server options…