Package Exports
- cloudvision-grpc-web
- cloudvision-grpc-web/es/cloudvision-grpc-web.js
- cloudvision-grpc-web/lib/cloudvision-grpc-web.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cloudvision-grpc-web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cloudvision-grpc-web
A grpc-web client for requesting CloudVision data from the frontend. This libraries exposed functions and utils that convert the grpc-web calls to Observable streams that can be manipulated using RXJS.
The package expects protobuf definitions to be generated via ts-proto
Installation
npm install cloudvision-grpc-web
or
yarn install cloudvision-grpc-web
Usage
import { fromResourceGrpcInvoke } from 'cloudvision-grpc-web';
import { DeviceServiceGetAllDesc, DeviceStreamRequest } from '../generated/arista/inventory.v1/services.gen';
const requestAllMessage = DeviceStreamRequest.fromPartial({});
const grpcRequest = fromResourceGrpcInvoke(DeviceServiceGetAllDesc, {
host: 'http://cvphost',
request: { ...requestAllMessage, ...DeviceServiceGetAllDesc.requestType },
});
// Will print out each data message as it arrives
grpcRequest.data.subscribe({
next: (val) => console.log('data', val))
})
// Will print out any Grpc metadata or errors as they happen
grpcRequest.messages.subscribe({
next: (val) => console.log('control message', val))
})