Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client close notification #44

Open
glassfishrobot opened this issue Aug 21, 2012 · 11 comments
Open

Client close notification #44

glassfishrobot opened this issue Aug 21, 2012 · 11 comments
Labels
Candidate4NextRelease This issues should be consider for inclusion in the next release project. Enhancement New feature or request

Comments

@glassfishrobot
Copy link

There is no notification event for client close.
Is it possible to add AsyncListener#onClose() when the client is disconnected ? This will be
useful for long running connections like server-sent events connection.

On the other hand, SE socket API itself doesn't provide that option. So there may be no way to get client close notification when there is no pending i/o.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by jitu

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@mpotociar said:
onDisconnect(...) would be a better name IMO. Also, if that's not possible due to the lack of JavaSE Socket API, should it be clarified that onError(...) could be used for that purpose?

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@shingwaichan said:
There is no way to know when the socket is closed from SE API.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
jfarcand said:
I disagree. Any NIO layer can detect when the underlying connection is getting closed. Look at Grizzly/Tomcat NIO/Netty, they all able to handle that case.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@shingwaichan said:
java.nio.channels.Channel#isOpen tests whether or not the channel is open.
So, we will revisit the issue.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
ash2k said:
Because this feature is missing it is not possible to stop resource consuming computations on server if client disconnects. Please, see this ticket for example https://sourceforge.net/apps/trac/bigdata/ticket/694

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
rstoyanchev said:
Adding a link to a discussion on Tomcat's user list.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
rstoyanchev said:
As one example of why this matters consider the SockJS protocol that provides HTTP fallback options for WebSocket.

The protocol does not define any client-side "close" frame. It expects the server will detect when the HTTP connection is closed and indeed a variety of server-side implementations in a range of languages (node, erlang, python, ruby) do.

A Java implementation – with Servlet 3 async for the long polling or HTTP streaming – however cannot detect when a client has gone away. This is a very fundamental, missing feature that puts Java Servlet-based implementations at a significant disadvantage.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA SERVLET_SPEC-44

@glassfishrobot
Copy link
Author

@gregw gregw added Enhancement New feature or request and removed Component: I/O labels Jan 18, 2020
@gregw gregw added the Candidate4NextRelease This issues should be consider for inclusion in the next release project. label Sep 8, 2020
@gregw
Copy link
Contributor

gregw commented Sep 8, 2020

I think such a new API is out of scope for 5.1... however we should clarify our existing APIs in similar circumstances such as clarifications of HTTP/2 behaviour with regards to async calls to onError etc. discussed in #256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Candidate4NextRelease This issues should be consider for inclusion in the next release project. Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants