5.0.2 • Published 2 years ago

cloudvision-grpc-web v5.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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))
})
5.0.2

2 years ago

5.0.1

3 years ago

4.14.0

3 years ago

4.13.1

3 years ago

4.13.0

3 years ago

4.12.1

3 years ago

4.12.2

3 years ago

4.11.0

4 years ago

4.12.0

4 years ago

4.10.1

4 years ago

4.10.0

4 years ago

4.9.2

4 years ago

4.9.1

4 years ago

4.9.0

4 years ago

4.8.0

4 years ago