I deployed a Meteor app at, for example, myapp.meteor.com
.../lib/_ddp.js
// url = "http://localhost:3000/";
url = "http://myapp.meteor.com";
DDPConnection = (Meteor.isClient) ? DDP.connect(url) : {};
if(Meteor.isClient) {
// set the new DDP connection to all internal packages, which require one
Meteor.connection = DDPConnection;
Accounts.connection = Meteor.connection;
Meteor.users = new Mongo.Collection('users');
Meteor.connection.subscribe('users');
Meteor.subscribe = Meteor.connection.subscribe;
}
.../lib/messages.js
Messages = new Mongo.Collection("messages", DDPConnection);
.../server/publications.js
Meteor.publish("messages", (limit=5) => {
let options = {
sort: [["timestamp.created", "desc"]],
limit: limit
};
return Messages.find({}, options);
});
Then I just do a Meteor.subscribe("messages")
on the client. However, this doesn’t seem to give me my expected messages from the server. The collections are still empty on the client side…