Description of problem: I tried to create a demo web application using Tomcat 7 (JBoss EWS 2.0) cartridge, just to check if websockets worked and I noticed that websockets does not work. As soon as the socked is open, it is closed. Then I tried to make a diy Cartridge (tomcat 7.0.55) myself, and the same behavior was found. I let the app working here http://tomcat-cladile.rhcloud.com:8000/examples/websocket/echo.xhtml But I found this app showing that a previous version of tomcat (7.0.39) with websockets work: http://tomcat7-riverwind.rhcloud.com:8000/examples/websocket/echo.html I tried to make it work with that version without success The funny part is that I tried wildfly 8.1 cartridge and I found websockets worked well. The issue has been reported before by other users out there. It doesn't look something related to tomcat, because the app works when tomcat is started locally. It should be something related to openshift that affects tomcat. Version-Release number of selected component (if applicable): How reproducible: http://tomcat-cladile.rhcloud.com:8000/examples/websocket/echo.xhtml Steps to Reproduce: 1. go to the url 2. try the example 3. the socket is closed as soon as it opens. Code 1011 is returned. or try this: 1. create an app with Tomcat 7 (JBoss EWS 2.0) cartridge 2. copy websocket example dristributed with tomcat. 3. run the app and see the results. Actual results: websocket is closed after it is open Expected results: websocket must remain open for 20 seconds after timeout closes it. Additional info:
EWS 2 ships with Tomcat 7.0.40, which does provide support for WebSockets, but it doesn't provide support for JSR 356, which enables scanning for classes annotated with @ServerEndpoint etc. Could you try the examples that ship with Tomcat 7.0.40 and see if they work for you?
Tested using the examples from the 7.0.40 Tomcat release - they work fine. If/when EWS supports JSR 356, we can look into possibly upgrading the EWS cartridge.
I finally have some time to try it and I confirm that with Tomcat 7 (JBoss EWS 2.0) cartridge shipping 7.0.40 websockets works. It is unfortunate that JSR 356 is not supported. I tried the native websockets with Tomcat 7.0.55 (DIY cartridge) and it doesn't work, which is weird, because it should but maybe there was a change in some point of time. Anyway, I was just looking for a solution that allowed me to use Tomcat as web server. Thanks for your help :).