I have a working JAX-RS webapp that implement some RESTfull services. I have developed it under WSO2 Studio and deployed it with WSO2 AS Web interface, all very simple.
Now I want add on my WebApp the possibility to open a WebSocket. I don't have found a standard procedure or examples on WSO2 AS documentation. My question is:
- Is possible do that?
- Can I have RESTfull implementation and WebSocket in the same war package? There is an example for do that? Best on WSO2 AS.
- How to setup a WebSocket application and deploy it on WSO2 AS?
Thank you.
UPDATE
I have write this extreme simple websocket application:
import java.io.IOException;
import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
@ServerEndpoint("/test")
public class TestSocket {
@OnMessage
public void onMessage(Session session, String message, boolean last) {
try{
if(session.isOpen()){
session.getBasicRemote().sendText("Received -> [" + message + "]", last);
}
}catch(IOException e){
try{
session.close();
}catch(IOException e1){
}
}
}
}
If I deploy on Tomcat server it run correctly if I deploy on WSO2 AS 5.3.0 (snapshot) the websocket is unreachable. I don't understand what i do wrong.