-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
grpcRuntime abstraction and Scala.Js interop #451
Comments
@andreaTP yes, it's definitely something that we can consider adding. As you start hacking on this it would be helpful if you add more details on top of what you provided above: what refactoring/generalizations would be needed on the runtime, and what type of changes would be needed for the code generator? |
To give a bit of background akka-grpc uses scalapb for code generation of the Scala 'model' classes, but not for the gRPC service API's, because there we want to use akka-stream-specific data types ( Obviously it would be cool to have this available for Scala.JS users as well, but I'm not too familiar with what that would entail. |
@thesamet sure, sorry for the delay, basically what I did is simply providing manually an implementation of the code that needs to be generated: https://github.com/andreaTP/grpc-interop-poc/blob/master/server-js/src/main/scala/com/example/protos/hello/GreeterGrpc.scala#L23 The implementation is now really poor, we would need proper marshalling/unmarshalling at first. @thesamet what's the current status of streaming support? |
Thanks for the explanation. scalapb-grpc supports streaming. |
BTW, if you need a way to convert your message to json in ScalaJS, check the various projects under https://github.com/scalapb-json |
thanks for pointing it out! 👍 I'll have a look soon. |
ok, now I have a more clear idea of what needs to be done, I should provide an alternative implementation of: that rely on something like: https://github.com/andreaTP/grpc-sjs/blob/master/src/test/scala/GrpcTest.scala#L20 and at least at first will rely on Proto/Json converter as you suggested. Any guidance on how to provide an alternative implementation that is platform specific? Is there already a mechanism or it should be implemented? thanks @thesamet |
If you want the code generator to produce different code for ScalaJS grpc servers, I would suggest adding a new generator. Maybe this would involve refactoring the existing code so it is reusable. If you want to have a JS runtime with a different implementation than the JVM runtime, take a look at how it's done to the Also, I wonder if the new generator and runtime functions can be shipped in a separate library (even if it's hosted in this repo)? |
@andreaTP Is this issue still being worked on? Let me know if this is not a priority anymore and in that case, we can just close this ticket. |
@thesamet I'm still busy for a couple of weeks, but I'm interested into going ahead on this later on, as per the issue itself, feel free to keep it open or close it as you prefer. |
Thanks for the update, @andreaTP . I'll close for now, and I would be happy to reopen this once you are able to continue to work on this. Feel free to reach out any time here or over gitter. |
Update, I was intrigued enough to play with grpc-web a little bit, and got a POC of this working. I might be able to publish some experimental support for this soon. |
Check out https://github.com/scalapb/scalapb-grpcweb If you add |
Wow, I will give it a spin soon! |
Now that we've got scalapb-grpcweb working, I'm considering this issue resolved. |
I'm opening this issue to have early feedback and keep in sync.
The basic idea is to have a common ground for seamless interoperability between Scala/Scala.Js GRPC services.
What I wish to work on in the future is a port of https://github.com/akka/akka-grpc to Akka.Js.
Today I've played around this:
https://github.com/andreaTP/grpc-interop-poc
The repo simply shows that it's feasible to work on a SJS implementation of the runtime.
I've used the official implementation for Node, but possibly one would like to have one based on https://github.com/improbable-eng/grpc-web
Now, I would like to understand how can we proceed and if this is a contribution that can be considered.
I think steps are:
One missing bit is the handling of streams, actually I haven't dig to understand if it's supported or not and what are the plans in case of "no"....
cc. @raboof
The text was updated successfully, but these errors were encountered: