As you may know, ZeroRPC documentation is sparse. I can't get Streaming between a Python server and a Node client to work.
Here is the Python method:
@zerorpc.stream
def PublishWhaterver(self, some_args):
yield "love"
yield "stack"
yield "overflow"
Here is the Node call:
export const tryStream = () => {
connectedZerorpcClient.invoke('PublishWhatever', (error, res, more) => {
console.log('STREAM', res, more);
});
};
This code will log "STREAM love", and then do nothing.
So here are my questions:
PublishWhatever
with relevant args so that it yield additionnal values ?What I am trying to implement is a Pub/Sub system but right now implementation seems to only exists for a Python server and a Python client, there are no Node example.
The example on the main page and tests are not relevant either, it shows how to stream an array that already exists when the invoke
method is called.Here the messages are generated during some heavy computations, I want the server to be able to tell the client "here, some data are ready" and never disconnect.
Well, ZeroRPC
actively promotes, that it is using its own python implementation code as a self-documentation how things work. In other words, no one has spent such additional efforts needed so as to publish a user-focused, the less a learning-process focused documentation.
Anyway, try to obey the few "visible" statements from the ZeroRPC description.
@zerorpc.stream
def PublishWhaterver(self, some_args):
yield ( "love", "stack", "overflow", ) # one, tuple-wrapped result-container