Git Product home page Git Product logo

Comments (11)

kondi avatar kondi commented on July 22, 2024 1

Quick fix: revert back protobufjs to ~6.6.5.
Looks like it is not compatible currently with 6.7.x, I will look at it later.

from rxjs-grpc.

kondi avatar kondi commented on July 22, 2024

Could you share your yarn lock file? Or if not used, the package json?

from rxjs-grpc.

JustGreg avatar JustGreg commented on July 22, 2024

yarn.lock
yarn.txt

from rxjs-grpc.

kondi avatar kondi commented on July 22, 2024

You can update rxjs-grpc to 0.1.2, it has set the correct protobufjs version.

from rxjs-grpc.

JustGreg avatar JustGreg commented on July 22, 2024

thank you, it works!

atom and vs code still show the error Property 'xyz' does not exist... with Typescript 2.2.1 and 2.2.2

from rxjs-grpc.

kondi avatar kondi commented on July 22, 2024

It should work well in VS code, I am using it everyday. Can you share a bit more? At least the ts file and on which line you have the error.

from rxjs-grpc.

JustGreg avatar JustGreg commented on July 22, 2024

sample.proto

syntax = "proto3";

package sample;

service Greeter {
  rpc SayHello (HelloRequest) returns (HelloReply) {}
  rpc SayMultiHello (MultiHelloRequest) returns (stream HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The request message containing the user's name and how many greetings they want.
message MultiHelloRequest {
  string name = 1;
  required uint32 num_greetings = 2;
}

// The response message containing the greetings.
message HelloReply {
  string message = 1; 
}

server.ts

import { Observable } from 'rxjs';
import { serverBuilder } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';

async function main() {
  type ServerBuilder = sample.ServerBuilder;
  const server = serverBuilder<ServerBuilder>('sample.proto', 'sample');

  server.addGreeter({

    sayHello(request) {
      return Observable.of({
        message: 'Hello ' + request.name
      });
    },

    sayMultiHello(request) {
      return Observable.timer(100, 500)
        .mapTo({ message: `Hello ${request.name}` })
        .take(request.num_greetings);
    }

  });

  server.start('0.0.0.0:50051');
}

main().catch(error => console.error(error));

client.ts

import { clientFactory } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';

async function main() {
  type ClientFactory = sample.ClientFactory;
  const Services = clientFactory<ClientFactory>('sample.proto', 'sample');

  const services = new Services('localhost:50051');
  const greeter = services.getGreeter();

  await greeter.sayMultiHello({ name: 'world', num_greetings: 3 }).forEach(response => {
    console.log(`Multi greeting: ${response.message}`);
  });

  await greeter.sayHello({ name: 'world' }).forEach(response => {
    console.log(`Greeting: ${response.message}`);
  });

}

main().catch(error => console.error(error));

server ts

from rxjs-grpc.

JustGreg avatar JustGreg commented on July 22, 2024

yarn.lock

from rxjs-grpc.

kondi avatar kondi commented on July 22, 2024

It looks like the grpc-namespaces is still the one generated with the old version.

from rxjs-grpc.

JustGreg avatar JustGreg commented on July 22, 2024

you are right! i recreated the namespace-file and now everythink looks good

from rxjs-grpc.

kondi avatar kondi commented on July 22, 2024

Released in v0.2.0.

from rxjs-grpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.