packages/grpc-native-core/src/client.js
function _write(chunk, encoding, callback) {
  /* jshint validthis: true */
  var self = this;
  if (this.writeFailed) {
    /* Once a write fails, just call the callback immediately to let the caller
       flush any pending writes. */
    setImmediate(callback);
    return;
  }
  var outerCallback = function(err, event) {
    if (err) {
      /* Assume that the call is complete and that writing failed because a
         status was received. In that case, set a flag to discard all future
         writes */
      self.writeFailed = true;
    }
    callback();
  };
  var context = {
    encoding: encoding,
    callback: outerCallback
  };
  this.call.sendMessageWithContext(context, chunk);
}
function _write(chunk, encoding, callback) {
  /* jshint validthis: true */
  var self = this;
  if (this.writeFailed) {
    /* Once a write fails, just call the callback immediately to let the caller
       flush any pending writes. */
    setImmediate(callback);
    return;
  }
  var outerCallback = function(err, event) {
    if (err) {
      /* Assume that the call is complete and that writing failed because a
         status was received. In that case, set a flag to discard all future
         writes */
      self.writeFailed = true;
    }
    callback();
  };
  var context = {
    encoding: encoding,
    callback: outerCallback
  };
  this.call.sendMessageWithContext(context, chunk);
}
function _write ( chunk , encoding , callback ) { /* jshint validthis: true */ var self = this ; if ( this . writeFailed ) { /* Once a write fails, just call the callback immediately to let the caller
       flush any pending writes. */ setImmediate ( callback ) ; return ; } var outerCallback = function ( err , event ) { if ( err ) { /* Assume that the call is complete and that writing failed because a
         status was received. In that case, set a flag to discard all future
         writes */ self . writeFailed = true ; } callback ( ) ; } ; var context = { encoding : encoding , callback : outerCallback } ; this . call . sendMessageWithContext ( context , chunk ) ; }
Write a message to the request stream. If serializing the argument fails,
the call will be cancelled and the stream will end with an error.
@name grpc~ClientWritableStream#write
@kind function
@override
@param {*} message The message to write. Must be a valid argument to the
serialize function of the corresponding method
@param {grpc.writeFlags} flags Flags to modify how the message is written
@param {Function} callback Callback for when this chunk of data is flushed
@return {boolean} As defined for [Writable]{@link external:Writable}
 
Attempt to write the given chunk. Calls the callback when done. This is an
implementation of a method needed for implementing stream.Writable.
@private
@param {*} chunk The chunk to write
@param {grpc.writeFlags} encoding Used to pass write flags
@param {function(Error=)} callback Called when the write is complete
Write a message to the request stream . If serializing the argument fails the call will be cancelled and the stream will end with an error .