packages/grpc-native-core/src/server.js
function handleServerStreaming(call, handler, metadata) {
  var stream = new ServerWritableStream(call, metadata, handler.serialize);
  stream.waitForCancel();
  var batch = {};
  batch[grpc.opType.RECV_MESSAGE] = true;
  call.startBatch(batch, function(err, result) {
    if (err) {
      stream.emit('error', err);
      return;
    }
    try {
      stream.request = handler.deserialize(result.read);
    } catch (e) {
      e.code = constants.status.INTERNAL;
      stream.emit('error', e);
      return;
    }
    handler.func(stream);
  });
}
function handleServerStreaming(call, handler, metadata) {
  var stream = new ServerWritableStream(call, metadata, handler.serialize);
  stream.waitForCancel();
  var batch = {};
  batch[grpc.opType.RECV_MESSAGE] = true;
  call.startBatch(batch, function(err, result) {
    if (err) {
      stream.emit('error', err);
      return;
    }
    try {
      stream.request = handler.deserialize(result.read);
    } catch (e) {
      e.code = constants.status.INTERNAL;
      stream.emit('error', e);
      return;
    }
    handler.func(stream);
  });
}
function handleServerStreaming ( call , handler , metadata ) { var stream = new ServerWritableStream ( call , metadata , handler . serialize ) ; stream . waitForCancel ( ) ; var batch = { } ; batch [ grpc . opType . RECV_MESSAGE ] = true ; call . startBatch ( batch , function ( err , result ) { if ( err ) { stream . emit ( 'error' , err ) ; return ; } try { stream . request = handler . deserialize ( result . read ) ; } catch ( e ) { e . code = constants . status . INTERNAL ; stream . emit ( 'error' , e ) ; return ; } handler . func ( stream ) ; } ) ; }
User provided method to handle server streaming methods on the server.
@callback grpc.Server~handleServerStreamingCall
@param {grpc~ServerWritableStream} call The call object
 
Fully handle a server streaming call
@private
@param {grpc.internal~Call} call The call to handle
@param {Object} handler Request handler object for the method that was called
@param {grpc~Server.handleServerStreamingCall} handler.func The handler
function
@param {grpc~deserialize} handler.deserialize The deserialization function
for request data
@param {grpc~serialize} handler.serialize The serialization function for
response data
@param {grpc.Metadata} metadata Metadata from the client
User provided method to handle server streaming methods on the server .