QGrpcBidiStream Class

QGrpcBidiStream 类提供了处理双向流 RPC 的访问权限。更多

Header: #include <QGrpcBidiStream>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Qt 6.7
继承: QGrpcOperation

公共函数

virtual ~QGrpcBidiStream() override
void writeMessage(const QProtobufMessage &message)
(since 6.8) void writesDone()

信号

详细说明

QGrpcBidiStream 类提供了处理双向流远程过程调用(RPC)的接口,是四种 gRPC服务方法之一。

有关高级概述,请参阅Qt GRPC Client Guide

注: 用户负责管理Client 接口返回的唯一 RPC 处理程序,确保它们至少在finished 信号发出前存在。收到该信号后,处理程序可以安全地重新分配或销毁。

成员函数文档

[override virtual noexcept] QGrpcBidiStream::~QGrpcBidiStream()

摧毁QGrpcBidiStream.

[signal] void QGrpcBidiStream::messageReceived()

当流 RPC 收到来自服务器的新消息时,就会发出该信号。然后就可以使用read() 方法对收到的信息进行反序列化。

void QGrpcBidiStream::writeMessage(const QProtobufMessage &message)

序列化message 并将其发送至服务器。

[since 6.8] void QGrpcBidiStream::writesDone()

从客户端结束数据流(半关闭)。调用此函数后,服务器仍可发送响应。

此函数在 Qt 6.8 中引入。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.