I am new to learn QRemoteObjects, i understand usage of Direct Connection with a Dynamic Replica.But i don't understand Connections to Remote Nodes using a Registry mechanism.I got confused the relationship between QRemoteObjectRegistryHost, QRemoteObjectHost, QRemoteObjectNode and QRemoteObjectReplica, can anyone give me simple explanation?
In Registry method
server use code like this
regNode = QRemoteObjectRegistryHost(QUrl('local:registry'))
srcNode = QRemoteObjectHost(QUrl('local:replica'), QUrl('local:registry'))
#is there will create two Local Socket server?
client use
repNode = QRemoteObjectNode(QUrl('local:registry'))
What's the difference QUrl('local:registry') and QUrl('local:replica')?
And I think QRemoteObjectHost(QUrl('local:replica'), QUrl('local:registry')) is redundant in this method.
In the example you provide the advantage is not observed and therefore you see it redundant.
In some applications there is a need to have several sources and it would be redundant for the replicas to have to connect to each source, so the task of QRemoteObjectRegistryHost is to have a connection point for several sources and that the replicas are connected through it.
For example, the following scheme shows its use:
Multiple nodes can be registered through
QRemoteObjectHost, and theQRemoteObjectHostis registered in theQRemoteObjectRegistryHostso that anyQRemoteObjectNodecan obtain replicas of theQRemoteObjectHostnodes throughQRemoteObjectRegistryHost.To illustrate the functionality I created the following example:
register.py
replica.py
source.py
Then run the following commands on different CMDs/terminals:
And in the CMD/terminal console of replica.py you will see the following: