permaweb / ao

The ao component and tools Monorepo - 🐰 🕳️ 👈
https://cookbook_ao.arweave.dev
Other
190 stars 63 forks source link

'receive' bug, while call from frontend via the 'message' and 'result' function. #1031

Closed HelloRWA closed 2 weeks ago

HelloRWA commented 1 month ago

For the 2.0 upgrade, I already use the 'receive' feature in my code, but it have a problem that while in A process, it call the B process, the data send to B process just direct send to my frontend, that is not what I want, as A should wait for B process done with its job and return some data(such as payment token transfer successed), then A process continue to deal with its bussiness and finally can return back to frontend with the final result that Process A produce.

TillaTheHun0 commented 1 month ago

Hey @HelloRWA . This sounds like a discussion for the ao discord.

But fundamentally, the flow you described isn't how ao's architecture works. Message passing between ao processes is asynchronous. A's handling of the first message isn't "waiting" for B in the sense that B is blocking A from handling the first message. The first message handling concludes with A sending a message to B, and setting up a handler to receive a response later. Then B sends a message to A, which is then evaluated as a new message by the recieive handler you added earlier. It's all asynchronous.

Have you tried using the results instead of result to power your UI?