2 Replies Latest reply on Jun 16, 2013 10:21 AM by Rich Midwinter


    Rich Midwinter Newbie

      Is the following sufficient to deploy a ServerEndpoint?


      [code]import javax.websocket.EndpointConfig;

      import javax.websocket.OnMessage;

      import javax.websocket.OnOpen;

      import javax.websocket.Session;

      import javax.websocket.server.PathParam;

      import javax.websocket.server.ServerEndpoint;



      public class UpdateWebSocketServlet {



      public String echo(final String message, @PathParam("name") String name) {

        System.out.println("echo: " +message +" " +name);

        return name;




      public void open(final Session session, final EndpointConfig endpoint) {





      I've tried testing it with the page at http://www.websocket.org/echo.html and a URI of ws://host:port/webapp/websocket/test but while it connects the response isn't a String but a Javascript object with little of interest on it and the stdout logging I'd expect if it was getting into the endpoint is absent.


      ETA: Sorry, can't figure out the code formatting for the life of me either.

        • 1. Re: Websockets
          Stuart Douglas Master

          That should be all that is needed, there were some known bugs in Websockets in the Alpha1 release, however I don't think any of them would affect this endpoint.


          There is not special config that is needed to enable endpoints, as long as you are using the Undertow subsystem and not JBoss Web. Are you sure websocket.org test page can resolve your endpoint?

          • 2. Re: Websockets
            Rich Midwinter Newbie

            Thanks. Not sure quite what resolving an endpoint is? I can see in the Chrome dev tools that there's a connection with status 101 switching protocols and then it sends the default text they use. Little else though.