LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change web service refresh rate

Solved!
Go to solution

I'm running LabVIEW Web Service with an application which follow the method shown in the weather monitor example. But my problem facing here is I need to keep click the refresh button then the Web Service only can update the latest data for me. So can anyone help me to show example on how to let the Web Service webpage automatically update the value without press the refresh button. Thank you

0 Kudos
Message 1 of 5
(2,519 Views)

You need to do this at the client side since you cannot push things from server to client in HTTP, you (server) can only answer client requests.

 

Some possible solutions

  • Press that refresh button automatically (for Firefox use ReloadEvery)
  • Add a refresh header (wikipedia), probably you need to change from Terminal Output to Streaming Output otherwise Set HTTP Header.vi won't work. See help.
  • Separate webpage in two pages: a static page (html) and a dynamic part (xml or json or so) then use some javascript to write the xml contents in the placeholders on the html page.

I don't have experience with any of them.

0 Kudos
Message 2 of 5
(2,508 Views)

Hi Biggeveen, i want to try on your second method but for the refresh header i don't know how to insert it. Is the refresh header put on the 'response string' there ?

0 Kudos
Message 3 of 5
(2,502 Views)
Solution
Accepted by topic author Jellyfish

First of all your client needs to support it. If you use the LabVIEW HTTP Client (GET.vi and so on) you cannot use this method. A normal browser should.

 

Take a look at FindContacts.vi from the Address Book example.

 

The help topic linked in the previous post should get you on the way as well. The infos are a bit scattered all over help file but it should be possible to understand it.

 

Basically there are two output options for a web service VI: Terminal mode as used in the Weather example and Stream mode as used in the Address Book example VI.

 

Use the Stream mode and construct the HTML page yourself, then send it to the browser with Write Response.vi. Somewhere in the top of the HTML page you need to insert

<meta http-equiv="refresh" content="5">

 

So you should return a string like

<HEAD>
<TITLE>my title</TITLE>
<META http-equiv="refresh" content="5">
</HEAD>
<BODY>
<P>If your browser supports Refresh,
this page refreshes in 5 seconds.

And add some real contents here
</BODY>

 See W3C as well.

 

 

Good luck

0 Kudos
Message 4 of 5
(2,495 Views)

Thanks a lot Biggeveen. Is really help on me. Thank also of your links.

0 Kudos
Message 5 of 5
(2,491 Views)