Hi all, I have 2 mobile applications. the first application is for request and the second one is for approval. So every time when have a new request in app A, the app B will trigger it with show the pop up.
This is application A: for new request
Application B: for the approval
My question is How to make the page always auto refresh to get data (real time) asynchronously from the app A without clicking the refresh page manually? So when in the app A, the request button clicked or create the new records the records will appear to the app B inside the pop up.
I'm thinking to make a process but I don't know how to make the page auto refresh. Would you like to help me with the solutions?
I appreciate it Thanks :)
Here I attached the oml file for app A, the app B in the comment. Thanks
This is the app B
Hi Alim Manurung,
To achieve this we need to open a two-way interactive communication session between the user's browser/device and a server using web sockets.
Please find my blog for this.
https://kaargosoft.blogspot.com/2020/02/how-to-build-live-chat-application-in.html?q=sockets
Hope it helps.
You can use a JavaScript node with setInterval on OnReady event of your screen, or if you use popup in the event you use to put the popUp visible. like this
------------------------------------
function myFunction() {
// Your Outsystems Action to call to the refresh your data
console.log("This function runs every 30 seconds");
}
// Call myFunction every 30 seconds
setInterval(myFunction, 30000);
------------------------------------------In this code, myFunction is the function that will be called every 30 seconds.
The 30000 in setInterval is the time in milliseconds (1000 milliseconds = 1 second), so 30000 means 30 seconds.
You can replace myFunction with your own function and put your own code inside it to call your OutSystems action to refesh data.
Remember clear the interval with clearInterval() when you no longer need it to prevent unnecessary operations in OnDestroy screen event or when when you put your popup invisible, if is the case.
If you need help how to build it let me know.
Hi @Alim Manurung ,
I hope this forge component suits your requirement.
https://www.outsystems.com/forge/component-overview/10975/sse-push-event-hub-and-client
https://www.outsystems.com/forge/component-overview/13710/sse-mobile-examples
Regards,
Wasimkhan S