I'm trying to implement the following scenario: 1. Client calls a meteor-method. 2. Inside the meteor-method i make an HTTP-Post to a different server. 3. When the HTTP-Call is responded, the meteor method should return true and in the case an error occurs it should return false.

Here is what my meteor method looks like:

uploadUserImage: function(data_url,userid) { asyncfnc =function(data,uid){ HTTP.post("http://localhost:2000/upload", { data: { "data_url": data, "user_id": uid } },function(err,res){ console.log(res); if (err){ console.log("error"); throw new Error(err.message); } else{ console.log("return true"); return true; } }); }; var waitForResult = Meteor.wrapAsync(asyncfnc); var result = waitForResult(data_url,userid); return result; }

The HTTP-Call works and I also get into the Callback of the HTTP.post-function. But on the clientside where I called the meteor-method i don't get into my callback-function. It looks like this:

Meteor.call("uploadUserImage",data_url,Session.get("newUserID"),function (err, res) { if(err){ console.log(err); } else { console.log('response: ', res); } }); What am I doing wrong? Why is my meteor-method not returning anything? Is everything correct with my Meteor.wrapAsync()?

Thanks for your help!


No comments to display.