Socket
Book a DemoInstallSign in
Socket

pull-grpc

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-grpc

GRPC pull stream interface

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

pull-grpc stability

npm version build status test coverage downloads js-standard-style

GRPC pull stream interface.

Usage

const pull = require('pull-stream')
const grpc = require('pull-grpc')

const uri = 'localhost:50051'
const schema = `
  syntax = "proto3";
  package messages;

  service MessageThing {
    rpc EchoHello (stream Sup) returns (stream Sup) {}
  }

  message Sup {
    required string msg = 1;
  }
`

// server: echo each request back as the response
const server = grpc.server(schema, {
  echoHello: (call) => pull(call, call)
})
server.listen(uri, { secure: false })

// client: send the message "hey world" once
const sink = grpc.client(uri, { secure: false }, (err, source) => {
  if (err) throw err
  pull(source, pull.drain(write, end))

  function write (data) {
    console.log(`data: ${data}`)
    // => "data: hey world"
  }

  function end (err) {
    if (err) throw err
    console.log('server done!')
    server.close()
  }
})

pull(pull.once({ msg: 'hey world' }), sink)

API

pullGrpc

Installation

$ npm install pull-grpc

License

MIT

Keywords

pull-stream

FAQs

Package last updated on 24 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts