http://qs1969.pair.com?node_id=11130693


in reply to Dancer2: respond to client while making its own async call

Hi Steve

It's as simple as:

post '/blorgle' => sub { debug('Entering delayed handler'); delayed { my %params = params; flush; content '<html><body>ok</body></html>'; done; debug('Sent response'); # Do your async job here }; };

See Dancer2::Core::Response::Delayed, https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#Delayed-responses-(Async/Streaming)

Hope this helps!


The way forward always starts with a minimal test.