users@glassfish.java.net

Re: GF 3.1.1 WebSocket support - cannot enable WebSockets

From: <forums_at_java.net>
Date: Fri, 20 Jan 2012 06:43:08 -0600 (CST)

OK, I was able to reproduce the issue against 3.1.2.  When I tested the
issue, the first time the client is run, a 200 is returned (with content as
genered by doGet() in your servlet), but if I ran the client a second time,
then it would work as expected.  The reason for this is because at the time
of the first request the Servlet that performs the WebSocket application
initialization hadn't been instantiated yet.  To work around this, I simply
marked the servlet to be loaded at startup.  After doing so, the client was
able to make the ws connection on the first attempt.

Additionally, there are some API differences between the WS code in 3.1.1 and
3.1.2.  I've made the changes to your server-side code and have re-attached
them here (as a maven project for convenience).  Using that project, you'll
need to update the client to connect to the url:
ws://localhost:8080/test-1.0-SNAPSHOT/test.

Let us know how this goes.

-rl


--
[Message sent by forum member 'rlubke']
View Post: http://forums.java.net/node/882757