Registry / communication / grpc-web-client-dm-ws

grpc-web-client-dm-ws

JSON →
library0.5.3jsnpmunverified

grpc-web-client is a library for making gRPC-Web requests from browsers and Node.js. Version 0.5.3 is the current stable release. It provides three main request functions: unary, invoke, and client, supporting unary, server-streaming, and client-streaming RPCs. Requires peer dependencies google-protobuf and @types/google-protobuf. Ships TypeScript types. Differentiator: one of the first client libraries for gRPC-Web, enabling browser-based gRPC calls without a proxy in some setups.

npm install grpc-web-client-dm-ws
INSTALL
IMPORT
SIG · GRPC-WEB-CLIENT-DM
G
grpc-web-client-dm-ws
communicationjavascriptv0.5.3
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'
const grpc = require('grpc-web-client')
ESM-only; CommonJS require is not supported. Use TypeScript or ES module imports.
grpc.unary
import { grpc } from 'grpc-web-client'; grpc.unary(ServiceMethod, { request, host, onEnd })
import { unary } from 'grpc-web-client'
unary is a method on the grpc object, not a separate export.
gRPC Web Transport (e.g., default transport)
import { grpc } from 'grpc-web-client'
import { GrpcWebTransport } from 'grpc-web-client'
Transport is not exported directly; configure via grpc options or set globally.

Shows basic unary gRPC-Web call using generated service and message classes.

import { grpc } from 'grpc-web-client'; import { BookService } from './generated/proto/book_service_pb_service'; import { GetBookRequest } from './generated/proto/book_service_pb'; const getBookRequest = new GetBookRequest(); getBookRequest.setIsbn(60929871); const host = process.env.GRPC_HOST ?? 'http://localhost:8080'; 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
breakingPeer dependency version mismatch: google-protobuf and @types/google-protobuf must be exactly >=3.2.0 and <=3.x.
fix
Install correct peer deps: npm install google-protobuf@^3.2.0 @types/google-protobuf@^3.2.0
affects: >=0.5.0
deprecatedgrpc.unary callback onEnd signature changed in 0.5.0 to include 'trailers' field.
fix
Update onEnd to destructure { status, statusMessage, headers, message, trailers } from res.
affects: >=0.5.0
gotchaCommonJS require is not supported; must use ES module imports.
fix
Use import syntax or ensure bundler handles ESM.
affects: >=0.4.0
gotchaBrowser requires a gRPC-Web-compatible server or proxy; plain gRPC servers are not supported.
fix
Use Envoy or a compatible backend with gRPC-Web support.
affects: all
Errors
Common errors & fixes
TypeError: grpc_web_client_1.grpc is undefined
CommonJS require used instead of ES import.
fix
Replace const grpc = require('grpc-web-client') with import { grpc } from 'grpc-web-client'
Module not found: Can't resolve 'google-protobuf'
Missing peer dependency google-protobuf.
fix
npm install google-protobuf @types/google-protobuf
TypeError: grpc.unary is not a function
Incorrect import: unary imported as separate symbol.
fix
Use import { grpc } from 'grpc-web-client' and then grpc.unary(...)
Error: gRPC-Web requires a transport that supports 'application/grpc-web'
Server does not support gRPC-Web protocol.
fix
Ensure server uses gRPC-Web middleware or proxy (e.g., Envoy).
Upgrade
Version history
0.5.3latest on npm
Audit
Dependencies
google-protobufrequiredRuntime dependency for protobuf message classes
@types/google-protobufoptionalTypeScript type definitions for google-protobuf
Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
grpc-web-client-dm-ws — npm install grpc-web-client-dm-ws · libregistry