In Websocket 1.0, the javax.websocket.Session class provides methods #getBasicRemote() and #getAsyncRemote() which returns different RemoteEndpoints for either sending message synchronously (RemoteEndpoint.Basic) or asynchronously (RemoteEndpoint.Async).
However, to close a Websocket session (send the closing handshake) the only method is javax.websocket.Session#close(...). As it is a synchronous method it may block if there is no window on the underlying TCP connection to send the closing handshake. This can be a problem for implementations that only use Async I/O for sending Websocket message which are then forced to use Sync/Blocking I/O for sending the closing handshake.
(For example, in .Net, there is System.Net.WebSockets.WebSocket#CloseOutputAsync() method that async closes the WebSocket session.)
Also, javax.websocket.Session does not have a method to abort a WebSocket connection immediately. This might be needed for an application that needs to disconnect a Client e.g. as DoS prevention (for example, when a connected client reads data from the underlying TCP connection very slowly so that the App needs to buffer more and more messages for that client, the application may want to immediately abort the WebSocket connection).
Currently this is not possible - the App would need to wait to be able to send the closing handshake.
(For example, in .Net there is System.Net.WebSockets.WebSocket#Abort() method that immediately aborts the WebSocket connection and cancels all pending I/O operations.)
Please see the thread on [1] for a discussion on Tomcat's Users list about these issues.
In Websocket 1.0, the javax.websocket.Session class provides methods #getBasicRemote() and #getAsyncRemote() which returns different RemoteEndpoints for either sending message synchronously (RemoteEndpoint.Basic) or asynchronously (RemoteEndpoint.Async).
However, to close a Websocket session (send the closing handshake) the only method is javax.websocket.Session#close(...). As it is a synchronous method it may block if there is no window on the underlying TCP connection to send the closing handshake. This can be a problem for implementations that only use Async I/O for sending Websocket message which are then forced to use Sync/Blocking I/O for sending the closing handshake. (For example, in .Net, there is System.Net.WebSockets.WebSocket#CloseOutputAsync() method that async closes the WebSocket session.)
Also, javax.websocket.Session does not have a method to abort a WebSocket connection immediately. This might be needed for an application that needs to disconnect a Client e.g. as DoS prevention (for example, when a connected client reads data from the underlying TCP connection very slowly so that the App needs to buffer more and more messages for that client, the application may want to immediately abort the WebSocket connection). Currently this is not possible - the App would need to wait to be able to send the closing handshake. (For example, in .Net there is System.Net.WebSockets.WebSocket#Abort() method that immediately aborts the WebSocket connection and cancels all pending I/O operations.)
Please see the thread on [1] for a discussion on Tomcat's Users list about these issues.
[1] http://markmail.org/message/z2pxdxeto656byu3
Affected Versions
[1.0]