change in database driving update on webpage

change in database driving update on webpage

I have asked this awhile back but not able to find a good answer.

What we want to do is have something on the server force an update on a page.  The best example I can think of this is say you have 5 widgets in stock.  Say 2 people both have a page open where they can buy a widget.  Person 1 buys 2 widgets.  We would then want person 2's webpage to update (an ajax refresh of just the section with the quantity available) to update to say there are 3 widgets available.

Any ideas on how to do that?
Hi Jason,

The application servers are stateless, this means that they don't know which pages are currently open by whom. The "supported" way of checking these things is basically "check the state every X seconds/minutes" with javascript/Ajax. 

There are other ways of doing this. You can have a Node.js server with websockets that will react in javascript when they receive a message from the outsystems server. This means that you will have to define a protocoll that will somehow sinchronize the numbers between the outsystems server and the node.js server.

You can trigger a process in OutSystems (on create Entity) that will communicate the current number of products to the Node.js server to broadcast a message to all the users with open sockets on that page.

The problem with these integrations is that you'll have to deal with scaling, synchronizations, staging, ... of the Node.js by yourself. And you'll have tons of javascript to create and maintain.



Ok, thank you.  Had hoped there was an easier way to do that.