cloudvision-grpc-web
    TypeScript icon, indicating that this package has built-in type declarations

    4.12.0 • Public • Published

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

    Install

    npm i cloudvision-grpc-web

    DownloadsWeekly Downloads

    18

    Version

    4.12.0

    License

    MIT

    Unpacked Size

    423 kB

    Total Files

    27

    Last publish

    Collaborators

    • rufman