2

I have a program that monitors the GPIO values. I have a webserver installed with some PHP and javascript (jquery) stuff and there I can plot on-demand results.

Is there a way to show a data stream in the web?

2 Answers 2

2

You can have a look at Node.JS which a sperate http server that is dedicated for streaming data using SOCKETS on HTML5 or PUSHING data with some clever JS.

It might be a learning curve with Node.JS so what I would do is set the AJAX method you are using with a repeating timer in JS. Set it to like 10 seconds interval or faster if the data is not too much. That will imitate a simple "stream"

Or you could install or do some kind of SOCKET handler in PHP and use HTML5 SOCKETS on the browser to get real live stream.

0

What's the program that reads the GPIO values written in? If it's PHP, then you can use JQuery and XMLHTTPRequest s to retrieve the data and render it however you want with JS. If the program is written in, say python, then you'd have to get it to write the information to a file and have the PHP script read from that when requested by the JQuery.

2
  • this is exactly what I have, a C++ code reads and store into file. Then from the web browser a php calls this program and afterwards it returns stuff to the javascript and it is shown. But what I want (and asked for) is for a method to upload data in a stream way.
    – javirs
    Jul 3, 2014 at 9:27
  • What do you mean by 'in a stream way'? If you have two pages, one that reads the file from your C++ program and returns it, and the second has JQuery to update the information on-screen by sending XHRs to the first page and displaying it.
    – Luke Moll
    Jul 3, 2014 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.