Closed ashwaniare closed 9 years ago
If you have a module flag that indicates the request data is still being waited on (let's call it dataReady
and set it to false
by default), then you could have sendRequestXML()
continually return 'NoOp'
until that flag is true.
If you want the Web Connector to pause for an interval of time (currently 5 seconds) return the string “NoOp”, which will cause the Web Connector to call your getLastError callback: a “NoOp” returned from GetLastError will cause the QBWC to pause updates for 5 seconds before attempting to call sendRequestXML() again.
Currently, buildRequest()
just sends some hard-coded requests for testing until I develop a better system for that. But instead, you could have it asynchronously retrieve your data and set dataReady
to true
upon success.
Thanks for responding @johnballantyne .. So if I create such a flag and return 'NoOp' continuously until the flag is true, do I need to do something in the getLastError method also? I mean do I need to explicitly return 'NoOp' from there also?
@johnballantyne Thanks for the idea..Works like a charm!! :)
As I presume you found out, yes you'd need to return 'NoOp'
from getLastError()
as well. I'm glad you got it working @ashwaniare!
Yes, you're right.. I missed that part in the QB developer guide.. Thanks!
WHat I want to do is as soon as the sendRequestMethod is triggered by the QWC, is there a way to make an async call to get the actual request data from some other server and then prepare the QBXML and return that?