Registry / messaging / io-grpc

io-grpc

JSON →
library0.3.2jsnpmunverified

A lightweight RPC framework built on gRPC for Node.js, providing a simplified API for creating services and clients with streaming support. Current version is 0.3.2. It wraps gRPC with a middleware pattern, TLS support, and a route-based approach for defining RPC handlers. Differentiators include a minimal API surface and built-in middleware similar to Express, but the package is in early development with sparse documentation and no TypeScript support.

npm install io-grpc
INSTALL
IMPORT
SIG · IO-GRPC
I
io-grpc
messagingjavascriptv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createServiceRpc
const { createServiceRpc } = require('io-grpc')
const createServiceRpc = require('io-grpc')
Package exports an object, not a single function. Must destructure to get createServiceRpc.
createClientRpc
const { createClientRpc } = require('io-grpc')
const createClient = require('io-grpc').createClientRpc
While the above works, destructuring is cleaner. The package is CommonJS only.

Demonstrates how to create a gRPC service and client using io-grpc, including loading a protobuf file, adding a service handler, and making an RPC call.

const { createServiceRpc, createClientRpc } = require('io-grpc'); // Server const serviceRpc = createServiceRpc(); const route = serviceRpc.load('./api.proto').Route; serviceRpc.addService('Chat', (call) => { console.log(call.body); call.write({ content: 'response' }); }); serviceRpc.decorate(route); serviceRpc.bind('0.0.0.0:50051'); console.log('Server running on port 50051'); // Client const clientRpc = createClientRpc(); const clientRoute = clientRpc.load('./api.proto').Route; clientRpc.decorate(clientRoute, 'localhost:50051'); clientRpc.route('Chat', { content: 'hello' }, (call) => { console.log('Response:', call.body); });
Debug
Known issues
gotchaThe package is in early development (v0.3.2). API may change without notice. No stable release yet.
fix
Pin to a specific version and test thoroughly before upgrading.
affects: >=0.0.0
gotchaThe package does not export named exports as documented; it exports an object with createServiceRpc and createClientRpc. Using wrong import pattern breaks the application.
fix
Use destructured require: const { createServiceRpc } = require('io-grpc');
affects: >=0.0.0
gotchaProtobuf service names used in addService and route must match exactly the package and service name from the proto file (e.g., 'route.Chat'). Incorrect naming causes 'Method not found' errors.
fix
Ensure the string passed to addService/route matches the full service name including package, e.g., 'route.Chat'.
affects: >=0.0.0
gotchaThe package does not support ESM. Using import statements will fail.
fix
Use require() syntax; consider wrapping in a dynamic import if needed for ESM projects.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: createServiceRpc is not a function
Importing the package incorrectly (e.g., const createServiceRpc = require('io-grpc'))
fix
const { createServiceRpc } = require('io-grpc');
Error: Method not found: Route/Chat
Incorrect service name format used in addService or route calls
fix
Use the full service name as defined in the proto file, e.g., 'route.Chat'
Error: Cannot find module 'grpc'
grpc peer dependency not installed
fix
npm install grpc
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
grpcrequiredCore gRPC library used for underlying RPC communication
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
io-grpc — npm install io-grpc · libregistry