-
Notifications
You must be signed in to change notification settings - Fork 37
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
How to use bidirectional flow? #215
Comments
After checking the source code, I know the reason. The Equal overloaded in QGrpcSubscription is regarded as the same QGrpcSubscription as long as the method and the parameters are the same. \\file:qtprotobuf\src\grpc\qgrpcsubscription.h
...
bool operator ==(const QGrpcSubscription &other) const {
return other.method() == this->method() &&
other.arg() == this->arg();
}
... |
Hm, probably arguments are superfluous in this condition. Let me check why it's implemented this way. |
I think this is an issue in the design of the bidirectional subscription. What I understood from the current implementation, that bidirectional subscriptions should also support the argument change without re-instantiation of the subscription. So let's make this a bug instead. |
When I called subscribeUserEventLoopUpdates for the second time, the Golang-based server reentered the UserEventLoop method. Why didn’t the server think it was the same steam? |
Is it because of the Post parameter problem that the Golang server cannot recognize the two posts as the same steam? |
It's an issue in the bidirectional stream design. I didn't take into account that changing the argument is possible without recreating a stream. So how it currently works:
This scheme works fine with the unidirectional server stream. But for the bidirectional stream it should work another way:
|
Oops ... really got into trouble with this now.... :-( in many things i plan to use... As far as I understand, bi-directional stream does not accept any data immediately.
two things:
In general, I expected in the generated
|
@lubagov yeah, and the issue requires changes in Qt, as per my investigation. I'm checking if it's possible to extend existing networking API and support outgoing stream, but Qt Network was designed for great old HTTP1.1 where paradigm one request - one reply worked perfectly. What you could try is the Native gRPC channel that was introduced some time ago by @rapgenic and uses reference gRPC implementation as the backend. I didn't play much with it, but perhaps it requires some changes in the QtGrpc API as well. |
you men option |
I while not recompile sources... And not try use Native Channel but If i right understand qtprotobuf/src/grpc/qgrpcchannel.cpp Line 90 in c6d7977
Hard to understand code for me, but seems, it create separate thread for each subscription and using blocking call... And i don't like it :-) |
Yeah, perhaps it should be improved. Anyway, I'm digging to find a solution using Qt Network. |
I try to play.... Sync method normal working if i use But async method, not:
working, but
accordingly, at this point there is simply nowhere to fill it.... |
My mistake, normal work with grpc::ByteBuffer async method. I just didn't take into account the fact that the buffer is filled not in the Read method, but in the Next method in the next step. |
Ok, I checked the whole path of QNetworkRequest/QNetworkReply and сфт only state that it's impossible to implement client-side streaming without changes in QtNetwork. I will check if I could hack networking using some private modules. But for now, it looks impracticable. |
If QtNetwork is not suitable for this, we can use both the native implementation and other HTTP2 libraries. Hacking with private classes I would be afraid to use because of possible incompatibilities, if it is will not supported on Qt Project side. But if I use the native implementation, then it will not be in the same form as it needs to be improved now. For now, I want to try, it how it work as is, next make the channel this on asynchronous calls. If will ok, refine further with bi-directional stream. |
Agree, I will prepare the patch with necessary API changes anyway, since currently, it lucks the way to send a new "argument" to the server, but leave it unimplemented. |
lubagov@b4ade2e |
@lubagov at first look the patch looks good for me. Meanwhile could you please align naming and spaces according to common project coding style and perhaps submit a pull request if you feel it's ready :) Thanks for your contribution! |
I am currently trying to add bidirection subscriptions. Just a question why there is no |
lubagov@bb780d4 |
Pretty close to the design I would like to invent. Sorry that didn't provide any highlevel API yet, out of power these days. |
Question
How to use bidirectional flow?
The client calls subscribeUserEventLoopUpdates many times, but the server stream fails to receive the message.
proto file:
cpp code:
go code:
Additional context
The text was updated successfully, but these errors were encountered: