Page 1 of 1

callback - refresh

Posted: Mon Jul 26, 2021 3:23 am
by k2R400
Hello,

With the 5250 screens it was possible to attach a DTAQ and therefore allow a green screen to be refreshed on demand (and not by time interval).
I would like the same behavior with PUI, I will explain to you:

I have a PROG1 which displays a QRCODE.
When the user flashes this QRCode a PROG2 is called and asks the user to make a signature.
- How can my PROG1 know that PROG2 has been called?
- Do I have to make an Ajax request in my PROG1 every x seconds? Or is there a less resource intensive way?

Thank you

Re: callback - refresh

Posted: Mon Jul 26, 2021 12:24 pm
by Scott Klement
To me, this sounds like you're using a QRCode the way you would typically use other types of bar codes such as a UPC/EAN barcode. I don't think its really meant to be used that way? QRCodes are usually used like hyperlinks -- you scan them in order to open a web page.

That said, yes... if you wanted to make this work, you'd use an AJAX call to a back-end program that waits for the QRcode to be scanned. Instead of polling (checking every X seconds) you could consider using a long-wait type of design.. i.e., you do one AJAX call that sits and waits, maybe for several minutes... only only returns when the QRcode is finally scanned. This is much more efficient than polling every X seconds.

Unfortunately, there's no way to make a DTAQ work like green-screen. In order to make changes on the screen, an HTTP request must be initiated from the browser. Its not possible for the server to initiate a request to change the browser... that's not how HTTP works.

Re: callback - refresh

Posted: Mon Jul 26, 2021 1:19 pm
by k2R400
Scott,
Thank you for the answer.
It is indeed a QRcode that I need, because I want to give the possibility to users to make a signature either with the mouse, or with their phone by scanning a qcrode which will open an anonymous (responsive) program.
Now the concern is to know when the user will have signed.
In your answer, what I have trouble understanding is: "you do one AJAX call that sits and waits, maybe for several minutes ..", I have a little trouble understanding how ...

Regards

Re: callback - refresh

Posted: Mon Jul 26, 2021 1:49 pm
by Scott Klement
You make an AJAX request... the AJAX request waits for a server-side API (could be an RPG program, PHP, Node.js, whatever is easiest for you). That program sits and waits for the QRCode. This may be a long wait, it is fine. When the QRCode is received, it returns back to the AJAX request, which updates the screen.

Re: callback - refresh

Posted: Mon Jul 26, 2021 3:03 pm
by k2R400
Merci Scott !

Re: callback - refresh

Posted: Mon Jul 26, 2021 5:15 pm
by Scott Klement
De rien!