Skip to main content
DDP (Distributed Data Protocol) is Meteor’s protocol for real-time data synchronization between clients and servers. It provides the foundation for Meteor’s live query and method call infrastructure.

Installation

The ddp package is typically included by default in Meteor applications. It combines ddp-client and ddp-server.

Overview

DDP is a protocol that enables:
  • Remote Procedure Calls (Methods): Call server functions from the client
  • Publications and Subscriptions: Real-time data synchronization
  • Latency Compensation: Optimistic UI updates with automatic rollback
  • Automatic Reconnection: Resilient connection handling
  • Collection Synchronization: Keep client and server data in sync

Package Information

  • Version: 1.4.2
  • Summary: Meteor’s latency-compensated distributed data framework
  • Components:
    • ddp-client - Client-side DDP implementation
    • ddp-server - Server-side DDP implementation
    • ddp-common - Shared utilities
    • ddp-rate-limiter - Rate limiting for security

Architecture

DDP operates over WebSocket connections with automatic fallback:

Exports

  • DDP - Client and server
  • DDPServer - Server only

Connecting to DDP Servers

Default Connection

Meteor apps automatically connect to their own server:

Additional Connections

Connect to other DDP servers:
url
string
required
The URL of the DDP server to connect to
options
object
Connection options

Connection Options

Connection Status

Reactive Status

Manual Connection Control

Methods (RPC)

Defining Methods

Calling Methods

Method Context

Inside a method, this provides:

Publications and Subscriptions

Publishing Data

Subscribing to Data

Subscription Callbacks

Latency Compensation

DDP implements optimistic UI updates:

Disabling Simulation

DDP Message Format

DDP uses JSON messages over WebSocket:

Method Call

Method Result

Subscribe

Data Added

Data Changed

Data Removed

Rate Limiting

Protect methods and publications from abuse:

Connection Hooks

ddp-rate-limiter

Rate limiting for DDP methods and subscriptions

mongo

MongoDB integration with DDP

accounts-base

User accounts over DDP

webapp

HTTP server for DDP

Source Code