-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GRPC Proto Server Bi-directional streaming controller incorrect behavior — doesn't provide stream handler back to method controller, while providing undefined reference #1286
Comments
@anton-alation I created similar issue - #1264 |
@anton-alation, |
@anton-alation, I've looked at your pr. Isn't it necessary to change grpc-client as well? To allow to send Observable and Subject? |
@adubrov So we have a bit of cases here:
So in the big picture, GRPC support on Nest is working only 50% of it should be actually. As we can assume (I am not big user of Nest, but bringing it to life for one of the projects) the GRPC-Client is a way to dispatch messages to Grpc-server within Alation, so particular use-cases can be:
In this case, we can assume that there can be no streaming because we'll treat HTTP as a single dispatch message system, otherwise there probably should be WS or GRPC implementation for cases which require messaging
In this case, we need to assume that WS-SERVER as well can dispatch to WS-CLIENT back, and this is what actually supported on Nest WS implementation: https://docs.nestjs.com/websockets/gateways Assuming that between all of the parts we have networking abstraction there is none of the problems should happen to GRPC client because it's creating same stream object on it's own side awaiting stream to dispatch to it, providing Subscribable object back. One big thing we lack is a supporting documentation and code commentary for Nest GRPC. Second big thing is not enough understanding why it's required to be Observable (or Promise) passed back every time, and no actual stream passed to be dispatched for manual control (because we may have mechanics to dispatch that other than default Nest), so it seems very crucial to be able to get control over the stream with signaling to Nest that it shouldn't make any attempts to control the stream. It's a matter of choice on how to build specific applications which require persistent connections to be strict part of it, and Observable pattern (and RxJs) can actually complicate things there neither than provide any help :) Subjective of course ;) |
@anton-alation it not alway only this cases you described. Sometimes it just interaction between 2 microservices when you need to have streaming. |
@adubrov PR doesn't prevent you to continue with Observable in the way you want to use it. Instead of returning My problem is that the stream handler in my case going into the very different dispatcher than a controller we catching the stream in, so I really need the stream handler for very intelligent mechanics ;) Anyway check this line: It's explicitly said that if you want observables you got those in full ;) |
Published as 6.3.0 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
Defined following proto
Defined following controller
Console log on arguments outputs:
Expected behavior
First parameter should be stream handler with
.on
and.write
methods available for executionPossible problem
Stream service definitions doesn't have
.request
option on them, and should be passed down to clients as transport handlers with.on
and.write
methods available.Possible fix: in
node_modules/@nestjs/microservices/server/server-grpc.js
replace
call.request
tocall
on line76
Same fix for line: https://github.com/nestjs/nest/blob/5.4.0/packages/microservices/server/server-grpc.ts#L114
Minimal reproduction of the problem with instructions
Define bi-directional streaming GRPC interface via protobuffers and then create GRPC controller implementation as above
Environment
The text was updated successfully, but these errors were encountered: