Hi Kova,
You'll experience some real limitations to HTTP trying to do this. There is a multipart/x-mixed-replace mime-type that can be used (I think just with Mozilla based browsers) for things like constantly pushing image data to a browser for something like a webcam. However the support for this isn't consistent, so you'll have headaches trying to implement it. This is why so often a java applet/application or something "thicker" like a real IM application is used for chat rather than just HTTP/HTML.
I wrote a stand-alone Perl-CGI "web-chat" utility that uses periodic reloading to get the job done. It ain't pretty, but it might give you some ideas. It works pretty well, and I still use it occasionally where I work. It sounds much like what you have done.
| [reply] |
there exists a technique called pseudo-server-push, which means that one script is running all the time sending output to the browser in an unbuffered way. The problem with this technique is that if the stream breaks (because of proxies), no data is transferred any more.
Chats who use this technique is Ralfchat (only in combination with the database; but the code is not scambled) or GtChat (but the code is scrambled)
If I'd write a webchat, I'd think about Flash, because there you can easily set up a Socket-Client that can communicate easily with a perl-socketserver...
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
| [reply] |
Refreshing HTML Page at every x minutes? | [reply] |
Actually, I should point out that my current implementation has a meta tag that refreshes the page every 8 seconds. I'm looking for an implementation that'll work without having to refresh. Thanks!
| [reply] |
You can put a meta-refresh tag in the page, which'll cause it to re-request every so often. Also, you can make what's called a non-parsed-header cgi page... that is, the web server continues to stream something to the client continuously (as opposed to a fixed content-length).
Of course, if you were referring to how you would do this on the server-side, you can look into something that implements a "tail -f" type of behavior... either by, say, opening a pipe from "tail -f $file |", and doing non-blocking IO on it (see IO::Select), or good chance there's already a module that does something like this. (Maybe called Tail::Follow? I don't know. Check CPAN.)
------------
:Wq
Not an editor command: Wq
| [reply] |