2 Replies Latest reply on Jul 31, 2014 6:34 PM by David Jensen

    Is it possible to have more than one websocket endpoint in a application?

    Naidu M Newbie

      Can we have more than one server endpoint in a websocket application?

       

      For example i have a server endpoint with uri as "/echo1" and second server endpoint with uri as "/echo2"

       

      @ServerEndpoint("/echo1")

      public class EchoEndpoint1 {

        @OnMessage

        public void onMessage(Session session, String msg) {

        try {

        session.getBasicRemote().sendText(msg);

        } catch (IOException e) { ... }

        }

      }

       

      @ServerEndpoint("/echo2")

      public class EchoEndpoint2 {

        @OnMessage

        public void onMessage(Session session, String msg) {

        try {

        session.getBasicRemote().sendText(msg);

        } catch (IOException e) { ... }

        }

      }

       

      Can we do like this?

       

       

      Regards,

      Naidu