How to use Meteor DDP package standalone in browser?


#1

Is it possible to subscribe to data from Meteor via DDP stand-alone?

I found the Meteor DDP package which states this could be done.

How to use it in a browser stand-alone to receive e.g. collection updates?

Or do you know about other working DDP clients for the browser?

Thanks
Michael


#2

For standard static html websites (not Meteor apps) I use https://github.com/mondora/ddp.js/ in version 0.6.0 because it is a simple .js file which you can just include within your script tags in html. (as an example you can check simplechat.support and its static client files to download).

But there are also projects like: https://github.com/mondora/asteroid or https://www.npmjs.com/package/ddp-client


#3

Thanks for the quick response.

I can’t find the usage of ddp.js in your application. Should I check a specific version on Github?
The app is crashing when I try to run it with Meteor 1.2.1 on OS X.

Asteroid clearly states it’s a node implementation, so is ddp-client. Both seem to be backend only.

I am looking for a browser version to implement a little widget without the full meteor framework.


#4

Take a look at the following article: Wire up a Meteor application with an external HTML page


#5

For ddp.js check the docs for version 0.6 here: https://github.com/mondora/ddp.js/tree/v0.6.0 newer versions are different. You can grab ddp.js file from here: https://github.com/mondora/ddp.js/blob/v0.6.0/src/ddp.js

ps. could you post an issue regarding simplechat.support app and osx? https://github.com/juliancwirko/s-chat-app/issues thanks.


#6

I really dislike ddp.js’ methods API where we have to track the message ID and check for that ID in the results handler. I think per-method callbacks would have been much cleaner, or promises. But, at least asteroid adds that promise layer, thank goodness!