DDP Client icon

DDP Client

Establishes connection to DDP server

Overview

This node establishes a connection to a DDP (Distributed Data Protocol) server via WebSocket. It allows subscribing to specific data streams ("subscriptions") and monitoring collections for real-time changes. When data in the subscribed collections changes, the node emits updated JSON data.

Common scenarios include integrating with Meteor.js backends or other services using DDP for real-time data synchronization. For example, it can be used to listen to live updates of user data, chat messages, or any reactive data source exposed by a DDP server.

Properties

Name Meaning
URL The WebSocket URL of the DDP server to connect to.
Subscriptions List of subscription names to subscribe to on the DDP server.
Collections List of collection names to monitor reactively for changes; emits data when updated.

Output

The node outputs JSON arrays where each item corresponds to a monitored collection. Each output item has the structure:

{
  "name": "collectionName",
  "data": [ /* array of documents from the collection */ ]
}

This output reflects the current state of the collection whenever it changes.

The node does not output binary data.

Dependencies

  • Requires access to a DDP server supporting WebSocket connections.
  • Uses the simpleddp library for DDP protocol handling.
  • Uses the ws library as the WebSocket client implementation.
  • No internal n8n credentials are required, but the URL must point to a valid DDP WebSocket endpoint.

Troubleshooting

  • Connection timeout error: If the node cannot establish a connection within 5 minutes, it throws a timeout error. Ensure the URL is correct and the DDP server is reachable.
  • Connection lost error: If the WebSocket connection drops unexpectedly, an error is emitted. Check network stability and server availability.
  • Subscription issues: If subscriptions do not receive data, verify that the subscription names are correct and that the server supports them.
  • Collection monitoring: If no data is emitted for collections, ensure the collection names exist on the server and that the server sends reactive updates.

Links and References

Discussion