
A promise-based client for Meteor's Distributed Data Protocol (DDP).
Meteor-DDP is a powerful promise-based client designed to enhance communication between the client and server in Meteor applications. Released for versions prior to 1.0, starting with Meteor 0.5.7, it simplifies the process of dealing with DDP (Distributed Data Protocol) through a clean promise structure. This library is built on top of jQuery 1.5 or later, leveraging its Deferred objects to handle asynchronous tasks effortlessly.
With a variety of methods available, Meteor-DDP offers developers a robust toolkit for establishing WebSocket connections, executing remote procedure calls, and managing subscriptions to data on the server. Whether you're looking to manage document collections or handle user authentication through OAuth, this library is tailored to meet the needs of modern developers using the Meteor framework.
connect(): Initiates a WebSocket connection with the server, signaling the start of DDP communication. Resolves to a Promise upon successful connection.
call(methodName, [params, ...]): Executes a remote procedure call using methods defined in Meteor's API. Returns a Promise that resolves with the data received from the server.
subscribe(subscriptionName, [params, ...]): Subscribes to data published by the server, allowing real-time updates. Resolves to a Promise on successful subscription.
unsubscribe(subscriptionName): Cancels a subscription to previously published data without affecting the local collection. Returns a Promise that resolves on successful unsubscription.
watch(collectionName, callback): Observes a specified collection for any changes, invoking the callback with the updated document when changes are detected. Does not return a value.
getCollection(collectionName): Retrieves an object containing all locally stored documents from the specified collection.
getDocument(collectionName, documentId): Fetches a specific document from a collection using its unique identifier.
loginWithOauth(oauthLoginUrl): Facilitates login through an OAuth provider, returning a Promise that resolves once the login is successful.
This diverse array of features makes Meteor-DDP an invaluable asset for developers looking to build responsive and dynamic applications with Meteor.
