kondi / Rxjs Grpc
Licence: mit
Typesafe gRPC with RxJS in TypeScript
Stars: ✭ 184
Programming Languages
typescript
32286 projects
Projects that are alternatives of or similar to Rxjs Grpc
Book
《Go 语言编程之旅:一起用 Go 做项目》本书涵盖细分为 5 + 1 板块,分别是命令行、HTTP、RPC、Websocket 应用、进程内缓存以及 Go 语言中的大杀器。
Stars: ✭ 167 (-9.24%)
Mutual labels: grpc
Flutter Grpc Tutorial
[Tutorial] Asynchronous Flutter chat client with Go chat server which are powered by gRPC (simple and streaming)
Stars: ✭ 167 (-9.24%)
Mutual labels: grpc
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (-11.41%)
Mutual labels: rxjs
Buildbuddy
BuildBuddy is an open source Bazel build event viewer, result store, and remote cache.
Stars: ✭ 182 (-1.09%)
Mutual labels: grpc
Liftbridge
Lightweight, fault-tolerant message streams.
Stars: ✭ 2,175 (+1082.07%)
Mutual labels: grpc
Grpc Java Contrib
Useful extensions for the grpc-java library
Stars: ✭ 176 (-4.35%)
Mutual labels: grpc
U Bmc
Open-source firmware for your baseboard management controller (BMC)
Stars: ✭ 166 (-9.78%)
Mutual labels: grpc
Makeaplan public
【制定一个计划】是一个目标规划应用,通过最直接,最清晰的方式帮助你记录和追踪自己的计划,辅助你达成自己的目标。
Stars: ✭ 174 (-5.43%)
Mutual labels: grpc
Micro Starter Kit
Cloud Native GoLang Microservices - gRPC, GraphQL
Stars: ✭ 167 (-9.24%)
Mutual labels: grpc
Angular Nodejs Mongodb Customersservice
Code for the Integrating Angular with Node.js RESTful Services Pluralsight course.
Stars: ✭ 164 (-10.87%)
Mutual labels: rxjs
Go Grpc Examples
This repo contains examples and implementations of different types of GRPC services and APIs using Golang.
Stars: ✭ 180 (-2.17%)
Mutual labels: grpc
rxjs-grpc
Installation
$ npm install rxjs-grpc rxjs grpc
Quickstart
Create your protobuf definition file sample.proto
:
syntax = "proto3";
package sample;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
Generate your TypeScript interfaces:
$ ./node_modules/.bin/rxjs-grpc -o grpc-namespaces.ts *.proto
Implement your typesafe server returning Observable<sample.HelloReply>
:
import { of } from 'rxjs';
import { serverBuilder } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';
// Pass the path of proto file and the name of namespace
const server = serverBuilder<sample.ServerBuilder>('sample.proto', 'sample')
// Add implementation
server.addGreeter({
sayHello(request: sample.HelloRequest) {
return of({
message: 'Hello ' + request.name
});
}
})
// Start the server to listen on port 50051
server.start('0.0.0.0:50051');
Call it from a client:
import { clientFactory } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';
// Pass the path of proto file and the name of namespace
const Services = clientFactory<sample.ClientFactory>('sample.proto', 'sample');
// Create a client connecting to the server
const services = new Services('localhost:50051');
// Get a client for the Greeter service
const greeter = services.getGreeter();
// Call the service by passing a sample.HelloRequest
greeter.sayHello({ name: 'world' }).forEach(response => {
console.log(`Greeting: ${response.message}`);
});
Generated interfaces
import { Observable } from 'rxjs';
export namespace sample {
export interface ClientFactory {
getGreeter(): sample.Greeter;
}
export interface ServerBuilder {
addGreeter(impl: sample.Greeter): sample.ServerBuilder;
}
export interface Greeter {
sayHello(request: sample.HelloRequest): Observable<sample.HelloReply>;
}
export interface HelloRequest {
name?: string;
}
export interface HelloReply {
message?: string;
}
}
Examples
You can see a simple example project in the examples folder.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].