Below is my code in server/server.js file. When I call Meteor.apply('testMethod')
I get Error: listen EADDRINUSE
. I am running meteor app with meteorite, the only non-generic package installed is npm
var Fiber = Meteor.require('fibers');
var fiber = Fiber.current;
Meteor.methods({
testMethod: function(){
setTimeout(function(){fiber.run('test')}, 2000);
res = Fiber.yield();
console.log(res);
return res;
}
})
I know the most obvious solution here is to use Meteor's wrappers around fiber, but what I really want to implement is yielding from fiber on async call and then resuming within some event handler. And I have not found anything suitable for that.
Stack trace:
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at net.js:1135:9
at dns.js:72:18
at process._tickCallback (node.js:415:13)