With
var twitPost = Meteor._wrapAsync(twit.post.bind(twit));
function process(screen_name)
{
twitGet('users/show', {'screen_name': screen_name});
}
a synchronous call to process("screen_name") works fine, but
stream.on('tweet', function(tweet)
{
process(tweet.user.screen_name);
});
yields Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
Any ideas how/if I could make this work? I would like to go via some processing function that can do other stuff except call twitPost.
As it is written, methods that use Meteor code (particularly ones that access Collections) need to be wrapped with a Fiber. One way to do so is to use Meteor.bindEnvironment
:
stream.on('tweet', Meteor.bindEnvironment(function(tweet) {
process(tweet.user.screen_name);
}));