A lightweight JavaScript library for making AJAX requests to gRPC-web or gRPC Gateway endpoints from the browser. Current stable version is 1.0.13 with low release cadence (last release 2023). Provides a simple Promise-based interface for streaming and unary gRPC calls over XHR, without requiring gRPC-web or a service worker. Smaller bundle size compared to gRPC-web client, but limited to browser environments and lacks advanced features like client-side interceptors or metadata manipulation.
npm install grpc-xhrNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a gRPC XHR client and perform unary and streaming requests.
Use import syntax and ensure your environment supports ES modules.
For streaming, verify your gRPC-Gateway configuration returns response immediately.
Use google-protobuf for message encoding/decoding. Do not mix with @grpc/grpc-js.
Initialize client with { baseURL, headers } directly; no nested 'options' key.Replace const GrpcXhr = require('grpc-xhr') with import GrpcXhr from 'grpc-xhr'.Use import { grpcXhrFactory } from 'grpc-xhr'.Ensure baseURL is a valid absolute URL (e.g., https://example.com).