Qt6.5 GRPC component not support bidirectional streaming?
-
Hi All,
My .proto as below:
```
syntax = "proto3";package helloworld;
message HelloRequest {
string name = 1;
}message HelloResponse {
string message = 1;
}service HelloService {
rpc SayHello (HelloRequest) returns (HelloResponse) {}
rpc SayHelloStream(stream HelloRequest) returns (stream HelloResponse) {}
rpc ClientSayHello(stream HelloRequest) returns (HelloResponse) {}
rpc ServerSayHello(HelloRequest) returns (stream HelloResponse) {}
}option go_package = "proto/helloworld";
Using protoc to connect to the grpc code generated by the qtgrpcgen included in Qt6.5, code as below:
/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */
#ifndef Q_PROTOBUF_helloworld_client_H
#define Q_PROTOBUF_helloworld_client_H#include <QtProtobuf/QProtobufMessage>
#include <QtCore/QMetaType>
#include <QtCore/QList>#include <QtProtobuf/qprotobufobject.h>
#include <QtProtobuf/qprotobuflazymessagepointer.h>#include <memory>
#include <QAbstractGrpcClient>
#include <QGrpcCallReply>
#include <QGrpcStream>
#include "helloworld.qpb.h"namespace helloworld {
namespace HelloService {class Client : public QAbstractGrpcClient
{
Q_OBJECTpublic:
explicit Client(QObject *parent = nullptr);
QGrpcStatus SayHello(const helloworld::HelloRequest &arg, helloworld::HelloResponse *ret);
std::shared_ptr<QGrpcCallReply> SayHello(const helloworld::HelloRequest &arg);
Q_INVOKABLE void SayHello(const helloworld::HelloRequest &arg, const QObject *context, const std::function<void(std::shared_ptr<QGrpcCallReply>)> &callback);std::shared_ptr<QGrpcStream> streamSayHelloStream(const helloworld::HelloRequest &arg); std::shared_ptr<QGrpcStream> streamSayHelloStream(const helloworld::HelloRequest &arg, const QWeakPointer<helloworld::HelloResponse> &ret); QGrpcStatus ClientSayHello(const helloworld::HelloRequest &arg, helloworld::HelloResponse *ret); std::shared_ptr<QGrpcCallReply> ClientSayHello(const helloworld::HelloRequest &arg); Q_INVOKABLE void ClientSayHello(const helloworld::HelloRequest &arg, const QObject *context, const std::function<void(std::shared_ptr<QGrpcCallReply>)> &callback); std::shared_ptr<QGrpcStream> streamServerSayHello(const helloworld::HelloRequest &arg); std::shared_ptr<QGrpcStream> streamServerSayHello(const helloworld::HelloRequest &arg, const QWeakPointer<helloworld::HelloResponse> &ret);
private:
};
} // namespace HelloService
} // namespace helloworld#endif // Q_PROTOBUF_helloworld_client_H
I have found that currently only server streaming is supported, but client streaming seems to not be supported yet. Question: Using the existing Qt6.5 GRPC component, how can bidirectional streaming be implemented? Best Regards, Gray Hsu
-
Hi All,
My .proto as below:
```
syntax = "proto3";package helloworld;
message HelloRequest {
string name = 1;
}message HelloResponse {
string message = 1;
}service HelloService {
rpc SayHello (HelloRequest) returns (HelloResponse) {}
rpc SayHelloStream(stream HelloRequest) returns (stream HelloResponse) {}
rpc ClientSayHello(stream HelloRequest) returns (HelloResponse) {}
rpc ServerSayHello(HelloRequest) returns (stream HelloResponse) {}
}option go_package = "proto/helloworld";
Using protoc to connect to the grpc code generated by the qtgrpcgen included in Qt6.5, code as below:
/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */
#ifndef Q_PROTOBUF_helloworld_client_H
#define Q_PROTOBUF_helloworld_client_H#include <QtProtobuf/QProtobufMessage>
#include <QtCore/QMetaType>
#include <QtCore/QList>#include <QtProtobuf/qprotobufobject.h>
#include <QtProtobuf/qprotobuflazymessagepointer.h>#include <memory>
#include <QAbstractGrpcClient>
#include <QGrpcCallReply>
#include <QGrpcStream>
#include "helloworld.qpb.h"namespace helloworld {
namespace HelloService {class Client : public QAbstractGrpcClient
{
Q_OBJECTpublic:
explicit Client(QObject *parent = nullptr);
QGrpcStatus SayHello(const helloworld::HelloRequest &arg, helloworld::HelloResponse *ret);
std::shared_ptr<QGrpcCallReply> SayHello(const helloworld::HelloRequest &arg);
Q_INVOKABLE void SayHello(const helloworld::HelloRequest &arg, const QObject *context, const std::function<void(std::shared_ptr<QGrpcCallReply>)> &callback);std::shared_ptr<QGrpcStream> streamSayHelloStream(const helloworld::HelloRequest &arg); std::shared_ptr<QGrpcStream> streamSayHelloStream(const helloworld::HelloRequest &arg, const QWeakPointer<helloworld::HelloResponse> &ret); QGrpcStatus ClientSayHello(const helloworld::HelloRequest &arg, helloworld::HelloResponse *ret); std::shared_ptr<QGrpcCallReply> ClientSayHello(const helloworld::HelloRequest &arg); Q_INVOKABLE void ClientSayHello(const helloworld::HelloRequest &arg, const QObject *context, const std::function<void(std::shared_ptr<QGrpcCallReply>)> &callback); std::shared_ptr<QGrpcStream> streamServerSayHello(const helloworld::HelloRequest &arg); std::shared_ptr<QGrpcStream> streamServerSayHello(const helloworld::HelloRequest &arg, const QWeakPointer<helloworld::HelloResponse> &ret);
private:
};
} // namespace HelloService
} // namespace helloworld#endif // Q_PROTOBUF_helloworld_client_H
I have found that currently only server streaming is supported, but client streaming seems to not be supported yet. Question: Using the existing Qt6.5 GRPC component, how can bidirectional streaming be implemented? Best Regards, Gray Hsu