Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What technology shall I use for a webpage that constantly requests data from server

We need to create a web-based frontend for displaying some data. The problem is that the data needs to be updated about once a second. For me as a web-developer the obvious solution is AJAX. Unfortunately, one of the purposes of this web frontend is to be displayed inside of embedded browser window which is expected to run constantly for months or even years. That's it, months of work with no restart / refresh. During testing we ran a proof of concept interface (which requested a simple set of data each 1,5s) in Safari for over a month. During this period of time, the memory usage of Safari raised from ~30 MB to over 100MB. Thus we're afraid of stability of such a solution.

I'm wondering if you could recommend us any other technique for this task, possibly with less overhead (when requesting simple sets of data - as in our case - I'm afraid the HTTP headers are very significant part of data)

like image 529
migajek Avatar asked Jul 04 '11 19:07

migajek


People also ask

Which object can be used to request data from a web server?

The XMLHttpRequest object can be used to request data from a web server. The XMLHttpRequest object is a developers dream, because you can: Update a web page without reloading the page.

Which method will the browser use to communicate with the server?

Web browsers communicate with web servers using the HyperText Transfer Protocol (HTTP). When you click a link on a web page, submit a form, or run a search, the browser sends an HTTP Request to the server.

How send data from server to client without request?

You can use web-sockets which are two way communication between client and server that remain open and allow the server to send without request from the client. However web-sockets are new and browser support is only for the most current browsers.

What is a web server in web technology?

A web server is software and hardware that uses HTTP (Hypertext Transfer Protocol) and other protocols to respond to client requests made over the World Wide Web. The main job of a web server is to display website content through storing, processing and delivering webpages to users.


2 Answers

I would suggest looking into node.js and the now.js plugging, which allows for realtime updates via websockets. It even has support for older browsers, so if the browser does not support websockets, it will do a fall over to either a comet server implementation, AJAX or an iframe.

It's extremely easy to setup on a linux environment, and there's ample documentation to get you started.

It works with javascript and runs on the Google V8 javascript engine, so if you've ever worked with OOP Javascript, you should be able to pick it up relatively easy.

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

like image 107
Stephan Avatar answered Oct 24 '22 01:10

Stephan


How about Adobe AIR as front-end? You can use Flash/FLEX inside which have decent garbage collectors so long running shoudn't be a problem. AIR also allows to write in XHTML and JavaScript so it could be a good option if you're only familiar with those technologies

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

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

like image 33
Daimon Avatar answered Oct 24 '22 02:10

Daimon