This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
lieudusty's profile picture

Http question

Started by lieudusty, 21 January 2013 - 11:07 AM
lieudusty #1
Posted 21 January 2013 - 12:07 PM
Hi everyone :D/>

I'm wondering of theres a way to wait for a site to change. So instead of putting http.get in a loop waiting for the site to change, is there a more efficient way of doing this without spamming http?
Eric #2
Posted 21 January 2013 - 12:43 PM
That's not how the internet works.

The best you can do (at all) is open a persistent connection, but that's not possible with just HTTP GET and POST. You need some sort of socket API.
theoriginalbit #3
Posted 21 January 2013 - 01:21 PM
The only reason to do a http request in a loop is so that you can try to make sure you get a response if possible. if you got a response you would break the loop, else you would try say 3 more times or something before giving up and telling the user that it failed…
lieudusty #4
Posted 21 January 2013 - 03:57 PM
Well I'm making a program and I need to to continuously check a site to see if it had a change.
theoriginalbit #5
Posted 21 January 2013 - 04:06 PM
Well I'm making a program and I need to to continuously check a site to see if it had a change.
If the change is done server side before it is sent to the client then thats fine… however if it is done client side js like the status' at help.mojang.com then it cant be done…
lieudusty #6
Posted 21 January 2013 - 04:28 PM
Yeah like I have a php script thats going to update server side. How would I keep checking if the site changed without spamming http.get(). Is there a way to do it?
theoriginalbit #7
Posted 21 January 2013 - 04:30 PM
not that I know of… maybe just do a timer and have it refresh every say 10 seconds… then it isn't spamming and its refreshing at a moderate interval…