1.0.6 • Published 8 months ago

@krishnafkh/react-native-grpc v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-native-grpc

gRPC for react-native

Installation

npm install @krishnafkh/react-native-grpc

Usage

import { GrpcClient, GrpcMetadata } from '@krishnafkh/react-native-grpc';

GrpcClient.setHost('example.com');

// Bring your own protobuf library
// This example uses https://github.com/timostamm/protobuf-ts

const request = ExampleRequest.create({
  message: 'Hello World!',
});

const data: Uint8Array = ExampleRequest.toBinary(request);
const headers: GrpcMetadata = {};

const { response } = await GrpcClient.unaryCall(
  '/example.grpc.service.Examples/SendExampleMessage',
  data,
  headers
);

const responseMessage = ExampleMessage.fromBinary(response);

See examples project for more advanced usage.

Limitations

This library currently only supports unary and server-side streaming type RPC calls. PRs are welcome.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago