为什么客户端不立即 return 从客户端方法?

Why client does not instantly return from client method?

客户端方法

Meteor.methods({
  insertPost: function(data) {
    console.log('client')
    Posts.insert(data, function(err, ret) {
      console.log('client insert end')
    });
  },
});

服务器方法

Meteor.methods({
  insertPost: function(data) {
    console.log('server')
    Meteor._sleepForMs(200000);
    Posts.insert(data, function(err, ret) {
      console.log('server insert end')
    });
  },
});

客户提交

  'click #save': function(e) {
    // data = ....    
    Meteor.call('insertPost', data, function(error) {
      Router.go('/');
    });
  },

为什么客户端卡在表单页面,而不是立即转到“/”。

这是关于它的流星文档。

Calling methods on the client defines stub functions associated with server methods of the same name. You don't have to define a stub for your method if you don't want to. In that case, method calls are just like remote procedure calls in other systems, and you'll have to wait for the results from the server.

If you do define a stub, when a client invokes a server method it will also run its stub in parallel. On the client, the return value of a stub is ignored. Stubs are run for their side-effects: they are intended to simulate the result of what the server's method will do, but without waiting for the round trip delay. If a stub throws an exception it will be logged to the console.