Registry / devops / grpc-web-client-bloombox

grpc-web-client-bloombox

JSON →
library0.6.0jsnpmunverified

gRPC-Web client for browsers and Node.js (v0.6.0). Allows making gRPC-Web requests from JavaScript/TypeScript without a proxy. Requires google-protobuf and @types/google-protobuf as peer dependencies. Provides unary, server-streaming, and bidirectional streaming via three API functions. Custom fork by Bloombox. Release cadence: irregular. Unlike grpc-web from improbable-eng, this is a modified version with potential upstream changes.

npm install grpc-web-client-bloombox
INSTALL
IMPORT
SIG · GRPC-WEB-CLIENT-BL
G
grpc-web-client-bloombox
devopsjavascriptv0.6.0
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.

grpc
import { grpc } from 'grpc-web-client'
import grpc from 'grpc-web-client'
This is a named export, not default.
grpc.unary
grpc.unary(serviceMethod, options)
grpc.unary({ request, host, onEnd })
First argument is the service method descriptor, second is options object.
grpc.invoke
grpc.invoke(serviceMethod, options)
grpc.invoke(options)
Same signature as unary.
grpc.client
grpc.client(serviceMethod, options)
grpc.client(serviceMethod)
Missing second argument for host and transport.

Demonstrates a unary gRPC-Web call using generated service and message classes.

import { grpc } from 'grpc-web-client'; import { BookService } from './generated/proto/book_pb_service'; import { GetBookRequest } from './generated/proto/book_pb'; const getBookRequest = new GetBookRequest(); getBookRequest.setIsbn(60929871); const host = 'https://mygrpc.example.com'; grpc.unary(BookService.GetBook, { request: getBookRequest, host: host, onEnd: res => { const { status, statusMessage, message } = res; if (status === grpc.Code.OK && message) { console.log('Book:', message.toObject()); } else { console.error('Error:', statusMessage); } } });
Debug
Known issues
gotchaPeer dependencies google-protobuf and @types/google-protobuf must be installed separately.
fix
npm install google-protobuf @types/google-protobuf
affects: >=0.0.0
gotchaAll three functions (unary, invoke, client) require the service method descriptor as first argument, not just options.
fix
Correct: grpc.unary(ServiceMethod, options)
affects: >=0.0.0
gotchaThe grpc object is a named export; default import will not work.
fix
Use import { grpc } from 'grpc-web-client'
affects: >=0.0.0
gotchaCancellation returns undefined when called after completion.
fix
Always check request is not null before calling cancel.
affects: >=0.0.0
Errors
Common errors & fixes
Uncaught TypeError: Cannot read properties of undefined (reading 'getDescriptor')
Missing or incorrect first argument (service method descriptor) to unary/invoke/client.
fix
Ensure you import the generated _pb_service file and pass the correct method (e.g., BookService.GetBook).
TypeError: grpc.unary is not a function
Default import used instead of named import { grpc }
fix
Change import to: import { grpc } from 'grpc-web-client'
Module not found: Can't resolve 'google-protobuf'
Peer dependency not installed.
fix
Run: npm install google-protobuf @types/google-protobuf --save
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
google-protobufrequiredpeer dependency for protobuf classes
@types/google-protobufoptionalpeer dependency for TypeScript type definitions
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
grpc-web-client-bloombox — npm install grpc-web-client-bloombox · libregistry