Send data to page(browser) after page load (or during)

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Send data to page(browser) after page load (or during)

Post by Skara »

I have a difficult problem. To simplify the situation, I have a few files (written in perl) that move around a bit and do random stuff. *These files constantly run and update themselves.
I would like to code a web interface to view and manage these files.

The problem I'm having is how to get the page to constantly monitor their position and actions.
Now I could just use AJAX (which I'm not familiar) to check every minute or so for updates, but I'd rather the page update itself or something update the page whenever "something happens."

To again simplify:
automated file moves/updates -> webpage updates to show change

I'm willing to use most any (free) technology to get this done.
-- I've looked at Ruby on Rails because I'd heard Mongrel can do something like this, but I can't seem to find any documentation on it.
-- Can AJAX constantly check a page?
-- I remember a chat program written entirely in php once that worked by the page constantly loading. I'd rather not have the loading bar run like mad, but I'll take what I can get. I believe it might have had something to do with ob_start/ob_flush, but I really don't remember. Is this a possible solution?
-- Or--and I almost hate to ask--would Flash be a viable solution?

Thanks
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Send data to page(browser) after page load (or during)

Post by Ambush Commander »

AJAX can check the server for changes. In fact, that's what it's designed to do. There really is no way to have the server "contact" the client--basically unheard of in the web world. If you did it in Flash, you'd still be using asynchronous requests, just not Javascript and (probably) not XML. :-)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Send data to page(browser) after page load (or during)

Post by s.dot »

You could ping with AJAX every second or so and update if necessary. Another thing that comes to mind is php sockets. And lastly, an infinite loop that checks for stuff.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Re: Send data to page(browser) after page load (or during)

Post by Skara »

Alright. Well, maybe a better solution will come along, but for now I guess I'll see how close I can get with AJAX.

php sockets is confusing the hell out of me. At least in terms of this problem. Never worked with it before.

Thanks for the help. ;)
Post Reply