What is DDP Protocol | Introduction to DDP Protocol



DDP- Distributed Data Protocol is extensively used in a meteor and is highly recommended over other frameworks. It was originally developed by meteor team. There is nothing in it i.e Meteor specific.

DDP protocol can work with any database, framework, programming language, servers, clients and mobile devices. So let’s get ourselves familiar with Meteor before starting these steps We can assume that it is somewhat REST, but for WebSockets only. Uses sock js or WebSocket protocol as a lower-level transport. Protocol explicate some guidelines for communication between client and server.

DDP define some JSON messages over WebSocket/SockJS and its messages are JSON objects, with field specified to be EJSON. For more details on specification, you can use this link

With the introduction of DDP protocol the Javascript developers biggest problems like:

  • Querying a server-side database.
  • Sending the results to client-side.
  • Pushing modifications to the client side.

How it resolved?

It is the process when a user subscribes to set of data. The server keeps the user informed about the content of data which changes over time. Example- In live chat application like messenger, Instagram, WhatsApp etc. it automatically updates message list in a chat window. The principal logic is that we have to write messages on both sides (server and client). We can also synchronize them using DDP.

DDP

How does it work?

Connection

using(DdpClient client = new DdpClient("localhost:3000"))
{
client.ConnectAsync().Wait();
}

Subscription :- on meteor

Meteor.publish('MeteorPublished', function(){

return users.find({});

});

 

Publication :- on meteor

Meteor.methods({

AnyMeteorMethod: function (id)

{
console.log(" The message is: " + id.data);
}

});

I hope this article helps you and now you're aware of DDP protocol. For getting in touch with new technologies our articles will always help you. You can get more information from TechnoAlerts.

introductions to meteor.js with angular | install and start with meteor.js with angular

upload image in meteor.js using uploadfs and gridfs

DDP protocol

Dheeraj Balodia

"Slapping the keyboard until something good happens."Full stack developer and an avid technology enthusiast.

Leave a Reply

Your email address will not be published. Required fields are marked *