You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Nachbaur <MN...@rei.com> on 2000/09/20 22:43:40 UTC

OT: Server-push client page reload

This is off-topic, but I need an answer pretty quick, and I *am* writing this app using mod_perl, so its sorta related (also, I don't want the headache of re-subscribing to a new list).

You know those online web-based tech support chat systems?  Its commonly frame based, but its just like IRC, but over HTML.  when a user posts a message it immediatly pops up on the chat frame, and you submit your message through a regular-ol' HTML form.  I don't think this is an applet, because this works in all sorts of browsers.  I think its javascript, but I'm not sure. My main question, is when the server knows that a new message has been posted, how does it push that new page out to the client web browser?  I'm used to all page-views originating from the client...not the server.

Any ideas?

--man
Michael A. Nachbaur (KE6WIA)
mike(at)nachbaur(dot)com
http://www.nachbaur.com
"......I've got blisters on my fingers!!!"  -- Ringo Starr


Re: OT: Server-push client page reload

Posted by ed phillips <ar...@sirius.com>.
A very impressive 95 lines o' Perl Randal!

Ed



"Randal L. Schwartz" wrote:

> >>>>> "Michael" == Michael Nachbaur <MN...@rei.com> writes:
>
> Michael> This is off-topic, but I need an answer pretty quick, and I
> Michael> *am* writing this app using mod_perl, so its sorta related
> Michael> (also, I don't want the headache of re-subscribing to a new
> Michael> list).
>
> Michael> You know those online web-based tech support chat systems?
> Michael> Its commonly frame based, but its just like IRC, but over
> Michael> HTML.  when a user posts a message it immediatly pops up on
> Michael> the chat frame, and you submit your message through a
> Michael> regular-ol' HTML form.  I don't think this is an applet,
> Michael> because this works in all sorts of browsers.  I think its
> Michael> javascript, but I'm not sure. My main question, is when the
> Michael> server knows that a new message has been posted, how does it
> Michael> push that new page out to the client web browser?  I'm used
> Michael> to all page-views originating from the client...not the
> Michael> server.
>
> Michael> Any ideas?
>
> Server push is not universal.  Client Pull is more available.
> See <http://www.perlmonks.org/index.pl?node_id=31083> for an example
> of a very short client-pull webchat, from an upcoming WebTechniques
> column (past columns at <http://www.stonehenge.com/merlyn/WebTechniques/>).
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: OT: Server-push client page reload

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Michael" == Michael Nachbaur <MN...@rei.com> writes:

Michael> This is off-topic, but I need an answer pretty quick, and I
Michael> *am* writing this app using mod_perl, so its sorta related
Michael> (also, I don't want the headache of re-subscribing to a new
Michael> list).

Michael> You know those online web-based tech support chat systems?
Michael> Its commonly frame based, but its just like IRC, but over
Michael> HTML.  when a user posts a message it immediatly pops up on
Michael> the chat frame, and you submit your message through a
Michael> regular-ol' HTML form.  I don't think this is an applet,
Michael> because this works in all sorts of browsers.  I think its
Michael> javascript, but I'm not sure. My main question, is when the
Michael> server knows that a new message has been posted, how does it
Michael> push that new page out to the client web browser?  I'm used
Michael> to all page-views originating from the client...not the
Michael> server.

Michael> Any ideas?

Server push is not universal.  Client Pull is more available.
See <http://www.perlmonks.org/index.pl?node_id=31083> for an example
of a very short client-pull webchat, from an upcoming WebTechniques
column (past columns at <http://www.stonehenge.com/merlyn/WebTechniques/>).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: OT: Server-push client page reload

Posted by Craig McLane <cm...@citysearch.com>.
I believe they are using meta refresh tags in the html to refresh the page
on a regular interval.

Craig


On Wed, 20 Sep 2000, Michael Nachbaur wrote:

> This is off-topic, but I need an answer pretty quick, and I *am* writing this app using mod_perl, so its sorta related (also, I don't want the headache of re-subscribing to a new list).
> 
> You know those online web-based tech support chat systems?  Its commonly frame based, but its just like IRC, but over HTML.  when a user posts a message it immediatly pops up on the chat frame, and you submit your message through a regular-ol' HTML form.  I don't think this is an applet, because this works in all sorts of browsers.  I think its javascript, but I'm not sure. My main question, is when the server knows that a new message has been posted, how does it push that new page out to the client web browser?  I'm used to all page-views originating from the client...not the server.
> 
> Any ideas?
> 
> --man
> Michael A. Nachbaur (KE6WIA)
> mike(at)nachbaur(dot)com
> http://www.nachbaur.com
> "......I've got blisters on my fingers!!!"  -- Ringo Starr
> 


Re: OT: Server-push client page reload

Posted by ___cliff rayman___ <cl...@genwax.com>.
i think that this technique works with netscape but not with IE.  on IE you have to set-up channels.

Ime Smits wrote:

> | Plain old meta refreshes. Usually every 5 or 10 seconds or so. Perhaps
> | configurable on a user and/or server basis.
>
> You could make it even more smooth by doing a multipart document (aka server
> push): finishing a HTML document but not closing the HTTP connection and
> start a new document as soon as someone else drops a line. But that is a
> terrible thing to do in mod_perl, because each client will occupy an Apache
> process as long as he's connected. Writing a simple http daemon handling the
> chatbox on another port wouldn't be that complicated, and there are modules
> out there. Take a look at Apprentice, a realy slim httpd written in threaded
> perl, I'm sure it's somewhere on freshmeat.
>
> Ime

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/



Re: OT: Server-push client page reload

Posted by Ime Smits <im...@iae.nl>.
| I was under the impression that internet explorer dropped support for
| server push...

OK, didn't know that. We should probably lawsuit them for telling us
"Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" then ;)

Ime


Re: OT: Server-push client page reload

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 20 Sep 2000, Ime Smits wrote:

> | Plain old meta refreshes. Usually every 5 or 10 seconds or so. Perhaps
> | configurable on a user and/or server basis.
> 
> You could make it even more smooth by doing a multipart document (aka server
> push): finishing a HTML document but not closing the HTTP connection and
> start a new document as soon as someone else drops a line. But that is a
> terrible thing to do in mod_perl, because each client will occupy an Apache
> process as long as he's connected. Writing a simple http daemon handling the
> chatbox on another port wouldn't be that complicated, and there are modules
> out there. Take a look at Apprentice, a realy slim httpd written in threaded
> perl, I'm sure it's somewhere on freshmeat.

I was under the impression that internet explorer dropped support for
server push...

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org


Re: OT: Server-push client page reload

Posted by Ime Smits <im...@iae.nl>.
| Plain old meta refreshes. Usually every 5 or 10 seconds or so. Perhaps
| configurable on a user and/or server basis.

You could make it even more smooth by doing a multipart document (aka server
push): finishing a HTML document but not closing the HTTP connection and
start a new document as soon as someone else drops a line. But that is a
terrible thing to do in mod_perl, because each client will occupy an Apache
process as long as he's connected. Writing a simple http daemon handling the
chatbox on another port wouldn't be that complicated, and there are modules
out there. Take a look at Apprentice, a realy slim httpd written in threaded
perl, I'm sure it's somewhere on freshmeat.

Ime


Re: OT: Server-push client page reload

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 20 Sep 2000, Michael Nachbaur wrote:

> This is off-topic, but I need an answer pretty quick, and I *am*
> writing this app using mod_perl, so its sorta related (also, I don't
> want the headache of re-subscribing to a new list).
> 
> You know those online web-based tech support chat systems?  Its
> commonly frame based, but its just like IRC, but over HTML.  when a
> user posts a message it immediatly pops up on the chat frame, and you
> submit your message through a regular-ol' HTML form.  I don't think
> this is an applet, because this works in all sorts of browsers.  I
> think its javascript, but I'm not sure. My main question, is when the
> server knows that a new message has been posted, how does it push that
> new page out to the client web browser?  I'm used to all page-views
> originating from the client...not the server.

Plain old meta refreshes. Usually every 5 or 10 seconds or so. Perhaps
configurable on a user and/or server basis.

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org


Re: OT: Server-push client page reload

Posted by te...@blackhole.acon.nl.

Hi

type: multipart/x-mixed-replace

use CGI::Push qw(:standard)
do_push(-next_page=>\&draw_a_page)

sub draw_a_page {
	my ($q,$counter)= @_;
	return undef if $counter >100;
	my $time = localtime();
	return 	start)html(),
		h1('test'),
		'This page is caaled $counter times',
		hr,
		$time,
		end_html;
} 

This is what I used once just as a test , but not under mod_perl. 
Netscape does support it.  I understand that you have to set up channels
under MS.. Not any idea about that. Could somebody point me some
direction regarding channels. 

Arnold

On Wed, 20 Sep 2000, Michael Nachbaur wrote:

> This is off-topic, but I need an answer pretty quick, and I *am* writing this app using mod_perl, so its sorta related (also, I don't want the headache of re-subscribing to a new list).
> 
> You know those online web-based tech support chat systems?  Its commonly frame based, but its just like IRC, but over HTML.  when a user posts a message it immediatly pops up on the chat frame, and you submit your message through a regular-ol' HTML form.  I don't think this is an applet, because this works in all sorts of browsers.  I think its javascript, but I'm not sure. My main question, is when the server knows that a new message has been posted, how does it push that new page out to the client web browser?  I'm used to all page-views originating from the client...not the server.
> 
> Any ideas?
> 
> --man
> Michael A. Nachbaur (KE6WIA)
> mike(at)nachbaur(dot)com
> http://www.nachbaur.com
> "......I've got blisters on my fingers!!!"  -- Ringo Starr
> 


Re: OT: Server-push client page reload

Posted by Roger Espel Llima <es...@iagora.net>.
Michael Nachbaur asked:
> This is off-topic, but I need an answer pretty quick, and I *am*
> writing this app using mod_perl, so its sorta related (also, I don't
> want the headache of re-subscribing to a new list).
>
> You know those online web-based tech support chat systems?  Its
> commonly frame based, but its just like IRC, but over HTML.  when a
> user posts a message it immediatly pops up on the chat frame, and you
> submit your message through a regular-ol' HTML form.  I don't think
> this is an applet, because this works in all sorts of browsers.  I
> think its javascript, but I'm not sure. My main question, is when the
> server knows that a new message has been posted, how does it push that
> new page out to the client web browser?  I'm used to all page-views
> originating from the client...not the server.

The two "regular" answers are meta refresh and server push.  But meta
refresh is clunky and server push apparently doesn't work well with IE.
When I had to implement this, I found a third option that experimentally
seems to work quite well: just keep the connection open and send the
messages as they are generated.  Since major browsers show webpages
incrementally, you'll get much smoother display than with meta refresh.
The remaining problem is to get the browser to scroll down, but you can
do that with javascript.

And for clients where that doesn't work, there's always meta refresh.

OTOH, you probably don't want to do that with Apache and mod_perl, for
two reasons: 1) keeping an appache process per long-term client is
hugely wasteful, and 2) multiple processes are a lousy way to implement
a chat backend, because they need to notify each other of new messages.

-- 
Roger Espel Llima, espel@iagora.net
http://www.iagora.com/~espel/index.html