<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The first sentence should have been:<br>
It seems as though since "done" closes the connection, you can't
expect Dancer2 to keep sending data there.<br>
<br>
<div class="moz-cite-prefix">On 10/15/2015 3:16 PM, John J.
McDermott, CPLP wrote:<br>
</div>
<blockquote cite="mid:562017B0.8090102@jkintl.com" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
It seems as though since "done" closes the connection. The doc
says "If you are streaming (calling <code>content</code> several
times), you must call <code>flush</code> ". I think it needs to
be higher in the delayed block.<br>
<br>
I'm not sure how you'd tell routeB to use the current (hopefully
open) template, and just to keep sending.<br>
<br>
See
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://search.cpan.org/%7Exsawyerx/Dancer2-0.163000/lib/Dancer2/Manual.pod#Delayed_responses_%28Async/Streaming%29">http://search.cpan.org/~xsawyerx/Dancer2-0.163000/lib/Dancer2/Manual.pod#Delayed_responses_%28Async/Streaming%29</a><br>
<br>
--john<br>
<br>
<br>
<div class="moz-cite-prefix">On 10/15/2015 12:10 PM, Joerg
Fallmann wrote:<br>
</div>
<blockquote cite="mid:561FEC0A.9010602@tbi.univie.ac.at"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Hi again,<br>
Does anybody know if and how it is possible<br>
to render a template for the user and <br>
then forward to a new route,<br>
<br>
Something like <br>
<br>
<pre><code>get '/routeA/:*?' => sub {
my $id = params->{'id'};
my $blub = params->{'blub'};
delayed {
my $tt = Template->new(
{INCLUDE_PATH => "$path",
WRAPPER => 'layout.tt',
RELATIVE => 1,
}) || die "Template error: $Template::ERROR\n";
$tt->process('view.tt', {
'id' => $id,
'bla' => $blub
};
flush;
content $tt;
done;
};
forward '/routeB/',{ </code>
<code><code> 'id' => $id,
'bla' => $blub</code>
};
};
</code><code>get '/routeB/:*?' => sub {
my $id = params->{'id'};
my $blub = params->{'bla'};
# Do something from here on
}; </code>
</pre>
That would solve the async response troubles for me I guess.<br>
<br>
@John, I'd rather try to do as much as possible without having
to handle JSON additionally,<br>
if async streaming is possible the way I like to use it, I will
have no other choice anyway I guess.<br>
<br>
--joerg<br>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
dancer-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- ___
dancer-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a>
<a class="moz-txt-link-freetext" href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>