QtProtobuf  0.6
Protobuf plugin to generate Qt classes
GrpcSubscription Class Reference

GrpcSubscription provides access to gRPC subscriptions from QML. More...

#include <qquickgrpcsubscription_p.h>

Detailed Description

GrpcSubscription provides access to gRPC subscriptions from QML.

GrpcSubscription might be used from QML code to receive updates for gRPC server or bidirectional streaming methods. Follwing properties should be provided and can not be empty, to subscribe streaming method:

Properties

QtProtobuf::QAbstractGrpcClient *client

Client used for subscription.

bool enabled

Controls subscription status. If subscription is active, switch this flag to 'false' to cancel subscription. Switching to 'false' keeps all fields ready to restore subscription.

QString method

The name of streaming method that will be used for subscription.

QObject *argument

Pointer to argument that will be used for subscription.

QObject *returnValue

Value returned by the subscription (Note that it is the same "return" object passed by the "updated" signal)

Signals

updated(ReturnType value)

The signal notifies about received update for subscription. It provides "return" value ready for use in QML.

...
onUpdated: {
//Use value passed as argument to binding
...
}
}
GrpcSubscription provides access to gRPC subscriptions from QML.

error(QtProtobuf::QGrpcStatus status)

The signal notifies about error occured for subscription. Provides GrpcStatus as argument to assigned handler.

Note
Some errors at subscription initialization phase disable GrpcSubscription
id: mySubscription
...
onError: {
console.log("Subscription error: " + status.code + " " + status.message)
}
}

The documentation for this class was generated from the following file: