I can't think of a better title to describe the problem but here it is.
I have a function that is called at random unscheduled intervals by a module which receives data.
There's another module that utilizes websockets and takes in data in the following method
def ws_handler(ws):
for data in data_feed():
ws.send(json.dumps(data))
and the data_feed periodically yields an output.
I can't figure out a way to replace the dummy data_feed() with the feed coming from the first module without hosting a local server with additional websockets or using multithreading. I feel like threading shouldn't be necessary as the process is linear and attempting with asyncio pipeline both increases delay and i cant figure out a way to execute async task immediately.
question from:
https://stackoverflow.com/questions/65622967/pipe-output-from-repeated-function-calls-to-python-generator 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…