detect client abort in action

410 views
Skip to first unread message

Fabian Kessler

unread,
Sep 2, 2013, 5:16:37 PM9/2/13
to play-fr...@googlegroups.com
How can I check whether the client aborted within a play action?
I'm looking for the equivalent to PHP's connection_aborted() http://php.net/manual/en/function.connection-aborted.php
Can I listen on that event, or check the status? On the request() object I did not see anything related to it, and all I could google is this unanswered question: http://stackoverflow.com/questions/15419269/how-to-abort-controller-action-in-play-framework-2-1-when-client-cancel-request


James Roper

unread,
Sep 2, 2013, 8:56:21 PM9/2/13
to play-framework
Hi Fabian,

Play offers no such feature.  However, there are other ways to achieve the same thing, for example, if you have a long running request, you could do it as a websockets request, which let's you easily detect when the client navigates to a different page.

Regards,

James


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
James Roper
Software Engineer

Typesafe – Build reactive apps!
Twitter: @jroper

eaveswhi

unread,
Apr 30, 2014, 1:41:43 AM4/30/14
to play-fr...@googlegroups.com
Hi, James

Thank you for a great product.
And I have a question about this topic.

GlobalSetting.scala has the method, onRequestCompletion.
This callback seems to be called when connection disconnected or request handle finished.
And this callback perhaps seems to run on netty worker thread.

Can I use onRequestCompletion to detect connection abort?


Regards,
Reply all
Reply to author
Forward
0 new messages