Server-side parameter update to client.

In the Samples: " cpip\rabbitweb\humidity.c" example program is a variable called “hum” which is displayed on the client’s webpage. I would like the server when it has a new humidity reading to simply update the box on the client’s webpage for the new value without reloading the entire webpage. This is a similar request to say a stock price being continually updated by the server without refreshing the whole web page when the price changes. Can this be done, or is it beyond the state-of-the-art?

Thanks for any info,
Doug Ronald, W6DSR

You can’t push the new value from the Rabbit, but you can probably use some Ajax techniques to load a simple JSON structure with “hum” and other variables, and then update just the elements of the web page with the new values.

https://en.wikipedia.org/wiki/Ajax_(programming)

The Samples cpip\rabbitweb hermo_graph.c program demonstrates sending a data structure in JSON format.

Dynamic C doesn’t have a sample program for combining the JSON format with Ajax techniques. There is a sample that predates the JSON support in RabbitWeb, using Javascript generation to update multiple fields on a page without having to reload the entire HTML page: Samples/BL4S1xx/TCPIP/rweb_io_sample.c

I don’t think you’ll be able to run it on a target that isn’t one of the BL4S1xx-series SBCs, but you might be able to look through the components for ideas.

1 Like