Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Marek Potociar added a comment -

        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?

        Show
        Marek Potociar added a comment - 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?
        Hide
        Shing Wai Chan added a comment -

        There is no way to know when the socket is closed from SE API.

        Show
        Shing Wai Chan added a comment - There is no way to know when the socket is closed from SE API.
        Hide
        jfarcand added a comment -

        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.

        Show
        jfarcand added a comment - 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.
        Hide
        Shing Wai Chan added a comment -

        java.nio.channels.Channel#isOpen tests whether or not the channel is open.
        So, we will revisit the issue.

        Show
        Shing Wai Chan added a comment - java.nio.channels.Channel#isOpen tests whether or not the channel is open. So, we will revisit the issue.
        Hide
        Mikhail Mazursky added a comment -

        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

        Show
        Mikhail Mazursky added a comment - 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
        Hide
        rstoyanchev added a comment -

        Adding a link to a discussion on Tomcat's user list.

        Show
        rstoyanchev added a comment - Adding a link to a discussion on Tomcat's user list.
        Hide
        rstoyanchev added a comment - - edited

        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.

        Show
        rstoyanchev added a comment - - edited 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.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            jitu
          • Votes:
            14 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated: