Search code examples
iosjsonmeteorddp

Why is it better to use DDP to talk to Meteor server instead of using JSON?


I am interested in writing iOS apps, and other client apps that need to communicate with my Meteor server to update and get information.

Using this collection API https://github.com/crazytoad/meteor-collectionapi

I can perform CRUD operations on meteor collections using restful http methods and JSON from the iOS app.

But I read that it is preferred to use DDP to talk to the Meteor server. Which means I would have to get some iOS DDP communication tool. JSON parsing and making http requests are built into xcode. Why use DDP?


Solution

  • Both are totally different things.

    JSON is a data transfer format based on the JS object syntax. It's the notation/syntax how the data is written. Think of it as a car on the road, among different kinds of vehicles.

    DDP is a messaging protocol. It's how the data is structured and passed around for multiple systems to understand. Think of DDP as the traffic system.

    DDP could have been written in any other format (like XML, binary etc.) and passed through a different protocol (HTTP, FTP etc.) but the authors chose JSON on websockets.