| Author |
Message |
< Yaws mailing list ~ Comet ("streaming HTTP/JS"), Yaws and hard-coded stream_time |
| Guest |
Posted: Sun Feb 11, 2007 8:22 pm |
|
|
|
Guest
|
I'm experimenting with Yaws and the "Comet Pattern", which is about
sending real asynchronous stuff to the browser.
A browser portable way is i.e. having a hidden IFRAME which receives
MIME type text/html with content pieces of JS script tags which in
turn manipulate the main HTML DOM. Browsers will eval JS tags "as they
arrive" (incremental rendering).
see for example:
http://ajaxian.com/archives/iframe-script-tags-portable-comet
http://ajaxify.com/run/streaming/xmlHttpRequest/iframe/scriptTags/
and description of what I did below.
It's whats called "forever frame" in the following
http://alex.dojotoolkit.org/wp-content/LowLatencyData.pdf
versus the "long poll" technique.
--
Unfortunately, there seems to be a hard-coded timeout of 30s in
yaws_server.erl for streaming content.
I've attached a patch (for yaws_server.erl as it comes with Yaws 1.6
which allows
out/1
in Yaws to produce 2 new return values
{streamcontent_with_timeout, MimeType, FirstChunk, TimeOut}
{streamcontent_with_size_and_timeout, Sz, MimeType, FirstChunk, TimeOut}
which enables the user to set the timeout for streaming content,
including setting the TimeOut = infinity.
--
The patch seems to work, but I'm a total Erlang newbie .. so if someone
likes to use it, please QA it .. (in particular, I've not used/tested
the streamcontent_with_size_and_timeout stuff .. just extended it for
symmetry reasons).
Tobias
============
Details.
The content I produce in Yaws for the IFRAME contains only one
<erl></erl> piece which subscribes the Yaws worker process to a
registered (named) process P, and returns
{streamcontent, "text/html", "<html><body>"}.
Then, P will send JS script tags to all subscriber Yaws streaming
processes using
yaws_api:stream_chunk_deliver(..., "<script
type="text/javascript">window.parent.onData(5);</script>").
--
Problem is, when P does not send anything for some time, the Yaws
streaming worker dies with
=ERROR REPORT==== 11-Feb-2007::15:59:45 ===
Yaws process died: {stream_timeout,[{yaws_server,stream_loop_send,3},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p,5}]}
--
I've looked for "stream_timeout", seems to be produced in fun
stream_loop_send(Priv, CliSock, FlushStatus) ->
TimeOut = case FlushStatus of
flushed -> 30000;
unflushed -> 300
end,
receive
...
of yaws_server.erl, which seems to hit the hardcoded timeout of 30s.
--
I've verified, that after hacking above line
"flushed -> 30000"
for
"flushed -> 120000"
and recompiling yaws_server.erl, both Firefox 2 and IE 7 will
not timeout by themselfes, but still receive asynchronous JS tags
via the IFRAME even after 110s inactivity.
--
With the attached patch, one is able to set the timeout
{streamcontent_with_timeout, "text/html", "<html><body>", infinity}.
from the .yaws page and both Firefox/IE will receive tags "forever".
I've tested IE7 for a waiting time of 15min between tags sent. No
problem, IE itself does not timeout.
--
Post recived from mailinglist |
|
|
| Back to top |
|
| rsaccon |
Posted: Mon Feb 12, 2007 2:38 am |
|
|
|
User
Joined: 09 Aug 2006
Posts: 144
|
| I also experimented with comet pattern, and for iframe transport type, If I remember propperly, I sent after each 25 seconds a keep alive message to the browser, to prevent the 30 second timeout and to detect a disconnected browser, so |
|
|
| Back to top |
|
| noss |
Posted: Mon Feb 12, 2007 9:28 am |
|
|
|
User
Joined: 09 Oct 2005
Posts: 290
|
Is the thirty second timeout documented? I recall finding out by
reading source code when my connections mysteriously died.
On 2/12/07, Tobias Oberstein <tobias.oberstein@gmx.de> wrote:
> > I set a timer to go off before thirty sec of inactivity. Then send a
> > 'noop' message.
>
> Well, ok. Thats a workaround.
>
> >
> > In my case that noop updated the ui to reflect chat inactivity rather
> > than silent failure. So it was not really a noop.
> >
>
> I can see that it might be useful to sent some heartbeat at least every
> 30-120s anyway in many scenarios.
>
> Also, I just checked Opera 9 .. and that beast _does_ timeout < 5min
> on IFRAMEs in contrast to IE 7 and Firefox 2 at least.
>
> Tobias
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Feb 13, 2007 9:18 pm |
|
|
|
Guest
|
> Is the thirty second timeout documented? I recall finding out by
> reading source code when my connections mysteriously died.
I saw the "stream_timeout" from the console when running Yaws
in interactive mode and grepped the sources ..
The yaws.pdf does not seem to mention it ..
Tobias
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|