[jboss-jira] [JBoss JIRA] (WFLY-3490) Websocket onClosed not called on idle timeout
Emanuele Colombo (JIRA)
issues at jboss.org
Fri Jul 11 04:46:24 EDT 2014
[ https://issues.jboss.org/browse/WFLY-3490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984148#comment-12984148 ]
Emanuele Colombo commented on WFLY-3490:
----------------------------------------
If testing upstream means doing what is described here https://github.com/wildfly/wildfly, still it doesn't work. If you prefer I can provide you a netbeans project or a war to test.
> Websocket onClosed not called on idle timeout
> ---------------------------------------------
>
> Key: WFLY-3490
> URL: https://issues.jboss.org/browse/WFLY-3490
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Web Sockets
> Affects Versions: 8.1.0.Final
> Environment: Wildfly 8.1.0 Final on Linux (Centos/Fedora)
> Reporter: Emanuele Colombo
> Assignee: Stuart Douglas
>
> When implementing a JSR-356 websocket endpoint I set
> {{session.setMaxIdleTimeout(5000);}}
> in the *@OnOpen* method. This means that, if no traffic is generated on the websocket in five seconds, the websocket is automatically closed.
> Now, if the websocket si correcly closed by the client calling the "close" method in JS, the corrispective *@OnClose* method on the endpoint is called. But if the websocket is closed because of the idle timeout, on the server the *@OnClose* method is not called, and also *@OnError* method isn't called.
> I think the correct behaviour should be to call *@OnClose* even when the socket is closed because of the idle timeout, so that the application has the ability to make some cleanup. Also, this is the behaviour I see when deploying in other Java web/application server.
> The test code of my endpoint is the following:
> {code:title=EchoEndpoint.java|borderStyle=solid}
> @ServerEndpoint("/ws/echo")
> public class EchoEndpoint {
>
> @OnMessage
> public String onMessage(String message) {
> System.out.println("RECV: " + message);
> return message;
> }
> @OnOpen
> public void onOpen(Session session) {
> session.setMaxIdleTimeout(5000);
> System.out.println("OPEN");
> }
> @OnClose
> public void onClose() {
> System.out.println("CLOSE");
> }
> @OnError
> public void onError(Throwable t) {
> System.out.println("ERROR");
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jboss-jira
mailing list