Simple code fragment for connecting to remote collections via DDP
Last active
January 3, 2016 05:29
-
-
Save aaronthorp/8416585 to your computer and use it in GitHub Desktop.
Meteor.js - DDP Remote Connection for Meteor. @aaronthorp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isServer) { | |
var remote = DDP.connect('http://server1.com/'); | |
Items = new Meteor.Collection('items', remote); | |
} | |
if (Meteor.isClient) { | |
remote.subscribe('items', function() { | |
var items = Items.find(); | |
console.log(items.count()); // get 1 | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment