Giter VIP home page Giter VIP logo

Comments (10)

pjm17971 avatar pjm17971 commented on May 25, 2024 1

This is a little different from the actual code we're trying to write, but here's an example:
https://github.com/esnet/test-grpc-streaming

The watchMetric() rpc is here, and shows the problem:
https://github.com/esnet/test-grpc-streaming/blob/master/example_pb_service.d.ts#L36

There's a build script build_protos.sh that has the command I used to build those. Hopefully this is enough to have a look at it.

Thanks!

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024 1

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

Thanks for raising @pjm17971 and sorry to hear you are encountering difficulties. It's very possible that we have a gap in our test-coverage here - would you be in a position to create a repro case (preferably as a test)?

Thanks.

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

Hi @pjm17971 , sorry for the delay in getting back to you and thank you for creating such a thorough repro case for me.

So if you look at the generated javascript for the service you will see the root cause of the error:

Watcher.prototype.watchMetric = function watchMetric() {
  throw new Error("Client streaming is not currently supported");
}

This is a throw back to a previous version of grpc-web which didn't provide support for client-side streaming; support was added in [email protected] via the websocket transport.

ts-protoc-gen needs to be updated to provide support for this new functionality; I will convert your issue's title and summary to reflect that.

Thanks, and sorry for the inconvenience.

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

If I've read the docs correctly then the API should closely resemble the grpc-node one and will look something like this:

  • Client Side Streaming *
const client = doClientStream(...)
client.on('metadata', (metadata) => { /* handle metadata */ });
client.on('status', (status) => { /* handle grpc status when stream is closed */ });
client.write(/* some data */);
client.write(/* some data */);
client.end(); // complete sending data.
client.cancel(); // cancel the stream from the client.
  • Bidirectional Streaming *
const client = doClientBidiStream(...)
client.on('data', (msg) => { /* hande incoming data */ });
client.on('metadata', (metadata) => { /* handle metadata */ });
client.on('status', (status) => { /* handle grpc status when stream is closed */ });
client.write(/* send some data */);
client.write(/* send some more data */);
client.end(); // close the stream
client.cancel(); // cancel the stream from the client.

Feedback welcome from those who have used the grpc-node API in anger, please!

from ts-protoc-gen.

jared2501 avatar jared2501 commented on May 25, 2024

This API looks great to me! Would love to see an implementation, or can try and send a PR in a few days.

from ts-protoc-gen.

pjm17971 avatar pjm17971 commented on May 25, 2024

Thanks for looking at this @jonnyreeves. I think this API looks good. Really looking forward to being able to use this.

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

Being worked in on #82

from ts-protoc-gen.

jonny-improbable avatar jonny-improbable commented on May 25, 2024

One thing to note is that with the above API ClientStreams open the connection to the server when the first message is sent, where-as BiDiStreams will open the connection to the server immediately - Please let me know if this is undesirable

from ts-protoc-gen.

pjm17971 avatar pjm17971 commented on May 25, 2024

Any progress on this one?

from ts-protoc-gen.

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.