I can't seem to find this anywhere in the docs and all info on google is one stackoverflow post which is rather incomplete. I have an application which does geoip and I need the visitor's ip address. Not logged in user, all visitors.
Any ideas how you do this with meteor?
UPDATE: After more searches I found this code which seems to work so far:
var Fiber = Npm.require('fibers');
__meteor_bootstrap__.app.use(function(req, res, next) {
Fiber(function() {
console.info(req.connection.remoteAddress);
console.log(req);
next();
}).run();
});
but there's a problem. I can't link the ip address with the visitor itself since I can't send cookies or set session data from the server to the client like I would normally do in PHP/Python/Ruby.
I got the full request with it's headers but no visitor session id or something to pick this user out from the crowd.
Think of an application where you need to send a chat invite to all users from UK for example. You first need to geoip him then send the invite if everything matches up. So I need this back and forth.