What technology should I use for a web page that constantly requests data from the server

We need to create a web interface to display some data. The problem is that the data needs to be updated approximately once per second. The obvious solution for me as a web developer is AJAX. Unfortunately, one of the goals of this web interface should be displayed inside the built-in browser window, which is expected to work continuously for several months or even years. This is it, months of work without a restart / update. During testing, we tested the concept interface (which requested a simple data set every 1.5 s) in Safari for more than a month. During this time period, Safari memory usage increased from ~ 30 MB to over 100 MB. Thus, we are afraid of the stability of such a decision.

I am wondering if you can recommend us any other technique for this task, possibly at a lower cost (when requesting simple data sets - as in our case - I'm afraid that the HTTP headers are a very significant part of the data)

+6
source share
5 answers

I would suggest looking into node.js and connecting now.js, which allows you to update in real time via websockets. It even supports older browsers, so if the browser does not support web ports, it will fall on the implementation of the comet server, AJAX or iframe.

It is very easy to configure in a linux environment, and there is enough documentation to get you started.

It works with javascript and runs on the Google V8 JavaScript engine, so if you have ever worked with OOP Javascript, you could easily pick it up.

LINKS:
http://nodejs.org/
http://nowjs.com/

+1
source

What about Adobe AIR as a front-end? You can use Flash / FLEX, inside which there are decent garbage collectors, so long will not be a problem. AIR also allows you to write in XHTML and JavaScript, so this can be a good option if you are only familiar with these technologies.

PHP is not a good choice for this kind of query. Comet seems to be a good way to get data from the server. You can use, for example, the excellent Tornado (Python) as a backend.

ActionScript allows you to use TCP sockets so you can write your own protocol to improve performance and use BOOST Asio (C ++) or Netty (Java) as a scalable backend

+1
source

Maybe websocket? Instead of making an AJAX request every X seconds, the server pushes new data as it arrives.

0
source

My personal faverite is php4 +, mysql, apache or the lightpd web server.

Hard I also offer Python.

I specialize in what you're talking about, with that said, will you really look at the screen? If not, you should request the page using an http socket or via wget cronjob in a linux window.

Yes, the http header is very important, if you try to delete them, the web server gives the error "Server is a bad request."

Let me know what you decide, I have something to share :)

0
source

I suspect that the problem is not in AJAX as such, but in the sich browser: I donโ€™t think anyone did it with constant accounting, and I assume that all (repeated) loading processes will become some form of extra memory at the end.

I think you are best off using your data to feed yourself. You can obviously produce it in the same place (the server requested via HTTP or whatever you like best), but you donโ€™t need a full web browser if your goal is โ€œa couple of yearsโ€.

0
source

Source: https://habr.com/ru/post/891981/


All Articles