Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. Qt6.5 GRPC component not support bidirectional streaming?
Forum Updated to NodeBB v4.3 + New Features

Qt6.5 GRPC component not support bidirectional streaming?

Scheduled Pinned Locked Moved Unsolved Chinese
3 Posts 2 Posters 462 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrayHsu
    wrote on last edited by GrayHsu
    #1

    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_OBJECT

    public:
    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
    semlanikS 1 Reply Last reply
    0
    • G GrayHsu

      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_OBJECT

      public:
      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
      semlanikS Offline
      semlanikS Offline
      semlanik
      wrote on last edited by
      #2

      @GrayHsu Unfortunately it doesn't, we only planned to add support in Qt 6.7

      G 1 Reply Last reply
      0
      • semlanikS semlanik

        @GrayHsu Unfortunately it doesn't, we only planned to add support in Qt 6.7

        G Offline
        G Offline
        GrayHsu
        wrote on last edited by
        #3

        @semlanik Thank you for your answer. I will implement the functionality in my own way.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved