How to get the user IP address in Meteor server?

1 – Without a http request, in the functions you should be able to get the clientIP with: clientIP = this.connection.clientAddress; //EX: you declare a submitForm function with Meteor.methods and //you call it from the client with Meteor.call(). //In submitForm function you will have access to the client address as above 2 – With a … Read more

How can I deploy node modules in a Meteor app on meteor.com?

As of Meteor 6.0, now we need to use Npm.require() instead. Additionally, we need to declare the module as global variables, since Meteor now has file-level scope. var path = Npm.require(‘path’); var fs = Npm.require(‘fs’); var base = path.resolve(‘.’); var isBundle = fs.existsSync(base + ‘/bundle’); var modulePath = base + (isBundle ? ‘/bundle/static’ : ‘/public’) … Read more

Meteor’s subscription and sync are slow

Meteor is pushing the entire dataset to your client. You can turn off autopublish by removing the autopublish package: meteor remove autopublish Then create specific a specific subscription for your client. When you subscribe you can pass a session variable as an argument, so on the client you do something like: sub = new Meteor.autosubscribe(function(){ … Read more

Publish documents in a collection to a meteor client depending on the existence of a specific document in another collection (publish-with-relations)

What you are looking for is a reactive join. You can accomplish this by directly using an observe in the publish function, or by using a library to do it for you. Meteor core is expected to have a join library at some point, but until then I’d recommend using publish-with-relations. Have a look at … Read more