function _getBidiStreamingListener(method_definition, emitter) {
  var deserialize = common.wrapIgnoreNull(
    method_definition.responseDeserialize);
  return {
    onReceiveMetadata: function (metadata) {
      emitter.emit('metadata', metadata);
    },
    onReceiveMessage: function(message, next, context) {
      if (emitter.push(message) && message !== null) {
        var call = context.call;
        var get_listener = function() {
          return context.listener;
        };
        var read_batch = {};
        read_batch[grpc.opType.RECV_MESSAGE] = true;
        call.startBatch(read_batch, _getStreamReadCallback(emitter, call,
          get_listener, deserialize));
      } else {
        emitter.reading = false;
      }
    },
    onReceiveStatus: function (status) {
      emitter._receiveStatus(status);
    }
  };
}
function _getBidiStreamingListener(method_definition, emitter) {
  var deserialize = common.wrapIgnoreNull(
    method_definition.responseDeserialize);
  return {
    onReceiveMetadata: function (metadata) {
      emitter.emit('metadata', metadata);
    },
    onReceiveMessage: function(message, next, context) {
      if (emitter.push(message) && message !== null) {
        var call = context.call;
        var get_listener = function() {
          return context.listener;
        };
        var read_batch = {};
        read_batch[grpc.opType.RECV_MESSAGE] = true;
        call.startBatch(read_batch, _getStreamReadCallback(emitter, call,
          get_listener, deserialize));
      } else {
        emitter.reading = false;
      }
    },
    onReceiveStatus: function (status) {
      emitter._receiveStatus(status);
    }
  };
}
function _getBidiStreamingListener ( method_definition , emitter ) { var deserialize = common . wrapIgnoreNull ( method_definition . responseDeserialize ) ; return { onReceiveMetadata : function ( metadata ) { emitter . emit ( 'metadata' , metadata ) ; } , onReceiveMessage : function ( message , next , context ) { if ( emitter . push ( message ) && message !== null ) { var call = context . call ; var get_listener = function ( ) { return context . listener ; } ; var read_batch = { } ; read_batch [ grpc . opType . RECV_MESSAGE ] = true ; call . startBatch ( read_batch , _getStreamReadCallback ( emitter , call , get_listener , deserialize ) ) ; } else { emitter . reading = false ; } } , onReceiveStatus : function ( status ) { emitter . _receiveStatus ( status ) ; } } ; }
Produces a listener for responding to callers of bi-directional RPCs.
@private
@param {grpc~MethodDefinition} method_definition
@param {EventEmitter} emitter
@return {grpc~Listener}
Produces a listener for responding to callers of bi - directional RPCs .
Returns a listener that will be used to listen for messages from the server