Migration Async

Hello,
From the documentation it seems that I can do a find and replace.

Find all Meteor.call(‘my-method’, arg1, arg2, function(err, res){})

Replace by : Meteor.applyAsync(‘my-method-async’, arg1, arg2, function(err, res){})

Is this valid ?

This seems faster than what I am doing now :

Meteor.callAsync(‘my-method-async’, arg1, arg2).then(res)(function(err, res){}))

Thanks

Correct me if I was wrong: I don’t think you need to change anything because you has a callback function already.
The case you must change is calling without callback function. e.g:
const someVar = Meteor.call('my-method', arg1, arg2)
to
const someVar = await Meteor.callAsync('my-method', arg1, arg2)

Hello,
I don’t understand. In the documentation there is no example of callAsync with a callback.
On the client :
Meteor.callAsync(‘my-async-method’, arg1, function(err, res){})
will work ?
Or do I need the .then ?
Thanks.

1 Like

Just keep it as: Meteor.call(‘my-async-method’, arg1, function(err, res){})