Forum > Networking and Web Programming

Customer Display server and webpage [Solved]

(1/3) > >>

lainz:
Hi,

I need to make a Customer Display, something like is used in the banks or pharmacy for turns, but instead of showing who is next, showing the details of the buy in progress: list of products with price, total, method of payment, etc.

The data is inside a Lazarus application for Windows. I want to make a local web server that shows a webpage with that data, the server need to communicate with the GUI application to update the data.

What do you think will be a good way?

I think this is an option:
- GUI application sends the data to the local server
- Web Page served with the local server do a Get constantly to an endpoint in the same local server to bring the data in JSON, then is parsed and displayed (like for example using AngularJS - is the one I know)

But the main problem is that:
- I need to do Get requests constantly

And is not a problem of updating the list of products, due how is AngularJS is designed, it can update lists efficiently.

This needs to be a webpage, because I can show that information for example in a Tablet, if the commerce doesn't have a second monitor or a hardware capable of having 2 monitors.

Also I will show ads when there is no buy in progress..

taazz:
Yes that is the nature of stateless application. Once the html is created there is no state to compare against for changes. You need to re query the data again. Or are you trying to create a known state using websockets to push data back? This will have the side effect of a page that never ends loading.

lainz:
The page is only to be seen by the user, there will be no interaction at all, and will be running fullscreen.

And yes, with my idea this will never end loading data, it will be always communicating. I'm just starting the website html + css template, so I've not touched any code yet.

Option 1:
I will not serve static html only, but also JS that will do the 'Get' to a JSON endpoint every say, 4 seconds or less, I already used Brook Framework and works very fast as an endpoint.

So the webpage is only the structure, and that will be changed with the data by AngularJS code.

The delay will be sending the data from the GUI to the server, and from the server to the web app.

Option 2:
The other way is reloading the static HTML entirely made by the webserver, so there's no communication in that way, only a full page reload, no usage of AngularJS.

The delay is only between GUI desktop app and the server, then the build of the HTML, and showing that in the browser.

taazz:

--- Quote from: lainz on July 03, 2018, 09:01:16 pm ---The page is only to be seen by the user, there will be no interaction at all, and will be running fullscreen.

And yes, with my idea this will never end loading data, it will be always communicating. I'm just starting the website html + css template, so I've not touched any code yet.

Option 1:
I will not serve static html only, but also JS that will do the 'Get' to a JSON endpoint every say, 4 seconds or less, I already used Brook Framework and works very fast as an endpoint.

So the webpage is only the structure, and that will be changed with the data by AngularJS code.

The delay will be sending the data from the GUI to the server, and from the server to the web app.

Option 2:
The other way is reloading the static HTML entirely made by the webserver, so there's no communication in that way, only a full page reload, no usage of AngularJS.

The delay is only between GUI desktop app and the server, then the build of the HTML, and showing that in the browser.

--- End quote ---
go with option 2 in both of your cases the server will be hit in intervals for data the difference comes down between a json and a html page, it does not look that big (unless we are talking images).

sash:
I'm not sure I got your exact task, but in any case you don't need to refresh whole web page constantly.
There's a "server push" technique, for example a longpoll script.

Navigation

[0] Message Index

[#] Next page

Go to full version