latency compensation (the write fence): Meteor methods (such as the
auto-generated insert/update/remove collection methods) have two different
"done" messages. One is the "result" message which contains the method's
return value or error, and is delivered as soon as the method body returns
or throws. The other is the "updated" message, which specifies that any
writes done by the method have been reflected in data messages
(added/changed/removed/etc) sent from server to client. The latter method is
what links together the two components of DDP (methods and data). If any
collection write happens in a method body, then by use of an object called
the Write Fence, we ensure that the "updated" method does not get sent until
all possibly-affected cursors have been polled one time. The client uses
this message to prevent flicker (ie, latency compensation): essentially, any
documents that are modified by the client-side stub are "frozen" until the
method's "updated" message shows up, at which point we should have seen the
final value of the documents.
See related discussion with David Glasser