QGrpcHttp2Channel Class

The QGrpcHttp2Channel class is an HTTP/2 implementation of QAbstractGrpcChannel 接口。 更多...

頭: #include <QGrpcHttp2Channel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
繼承: QAbstractGrpcChannel

公共函數

QGrpcHttp2Channel (const QUrl & url , std::unique_ptr<QAbstractGrpcCredentials> credentials )
virtual ~QGrpcHttp2Channel () override

重實現公共函數

virtual QGrpcStatus call (QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret ) override
virtual std::shared_ptr<QGrpcCallReply> call (QAbstractGrpcClient * client , QLatin1StringView method , QLatin1StringView service , QByteArrayView args ) override
virtual std::shared_ptr<QAbstractProtobufSerializer> serializer () const override
virtual void startStream (QGrpcStream * grpcStream , QLatin1StringView service ) override

詳細描述

QGrpcHttp2Channel utilizes channel and call credentials. Channel credential QGrpcHttp2Channel supports SslConfigCredential key. When HTTPS is used, this key has to be explicitly specified and provide QSslConfiguration and value. The QSslConfiguration provided will be used to establish HTTP/2 secured connection. All keys passed as QGrpcCallCredentials will be used as HTTP/2 headers with related values assigned.

成員函數文檔編製

[explicit] QGrpcHttp2Channel:: QGrpcHttp2Channel (const QUrl & url , std::unique_ptr < QAbstractGrpcCredentials > credentials )

QGrpcHttp2Channel constructs QGrpcHttp2Channel with url used to establish channel connections and credentials .

[override virtual] QGrpcHttp2Channel:: ~QGrpcHttp2Channel ()

銷毀 QGrpcHttp2Channel 對象。

[override virtual] QGrpcStatus QGrpcHttp2Channel:: call ( QLatin1StringView method , QLatin1StringView service , QByteArrayView args , QByteArray & ret )

重實現: QAbstractGrpcChannel::call (QLatin1StringView method, QLatin1StringView service, QByteArrayView args, QByteArray &ret).

Synchronously calls the RPC method and writes the result to the output parameter ret .

The RPC method name is concatenated from the method and service parameters with the given args .

[override virtual] std::shared_ptr < QGrpcCallReply > QGrpcHttp2Channel:: call ( QAbstractGrpcClient * client , QLatin1StringView method , QLatin1StringView service , QByteArrayView args )

重實現: QAbstractGrpcChannel::call (QAbstractGrpcClient *client, QLatin1StringView method, QLatin1StringView service, QByteArrayView args).

Asynchronously calls the RPC method.

The RPC method name is concatenated from the method and service parameters with the given args . The method can emit QGrpcCallReply::finished () 和 QGrpcCallReply::errorOccurred () signals on a QGrpcCallReply returned object.

[override virtual] std::shared_ptr < QAbstractProtobufSerializer > QGrpcHttp2Channel:: serializer () const

重實現: QAbstractGrpcChannel::serializer() const .

返迴新近創建的 QProtobufSerializer shared pointer.

[override virtual] void QGrpcHttp2Channel:: startStream ( QGrpcStream * grpcStream , QLatin1StringView service )

重實現: QAbstractGrpcChannel::startStream (QGrpcStream *stream, QLatin1StringView service).

Starts a stream on grpcStream 使用 QGrpcStream::method () 和 service to get the name of the RPC method.

調用 QGrpcStream::handler () when the stream receives data from the server. The method may emit QGrpcStream::errorOccurred () when the stream has terminated with an error.