Details
-
Suggestion
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
None
-
78733798a (dev), 68d9b236b (dev), e359e4808 (dev), 42ce3ecdc (dev), 3b74fdff6 (dev), ceb97b09d (dev)
Description
I wish to discuss here APs of QtGrpcQuick plugin.
Now we already have ProtobufMessage and Client classes registered in QML.
ProtobufMessage usage (QGadgets based):
property answerRequest _answerReq property answerResponse _answerResp
Client usage (QObjects based):
Client { id: grpcClient }
Suggetion description:
For establishing a clien-server connection in QML we need to create a channel and attach it to the client/clients.
It means QtGrpc librarie's APIs shall be registered in QML context.
For such purpose QtGrpcQuick plugin is being created by me.
But APIs that plugin can provide are discusable, because it can be done in different ways.
So let's define it here !
I see at least 2 variants:
1. Extend as QObjects:
QGrpcHttp2Channel { id: myAPIChannel channelOptions: QGrpcChannelOptions { url: ... msecs: ... } } ....(may be another qml file) Client { channel: myAPIChannel } ... Client { channel: myAPIChannel }
2. Extend as QGadgets types + qobject singleton:
property grpcChannelOptions channelOptions1; Client { id: grpcClient1 } Component.onCompleted: { channelOptions1.host = "http://localhost:50051" var channel = QtGrpc.createAttachedChannel(QtGrpc.Http2ChannelType, grpcClient1, channelOptions1.options); _answerReq.message = "sleep" } .............(may be another qml file) property grpcChannelOptions channelOptions2; Client { id: grpcClient2 } Component.onCompleted: { channelOptions2.host = "http://localhost:50051" var channel = QtGrpc.createAttachedChannel(QtGrpc.Http2ChannelType, grpcClient2, channelOptions2.options); _answerReq.message = "sleep" }
Note: QObjects are more functional in comparison with QGadgets, because QObjects have signals mechanism. It is much more useful.
But in such case I believe we need to inherit base QAbstractChannel and some other basic classes from QObject.
Anyway what do you think: 1 or 2, or something else?{}