I'm trying to use websocket using openshift and wildfly 8.1.
The application works on a local wildfly server on port 8080.
But, I'm not able to connect on openshift server for the websocket using port 8000.
Curriously, if I use port forwarding (rhc port-forward), I'm able to connect on the local forwarded port.
I think there is a missconfiguration for port forwarding on openshift.
Here is my code :
import javax.websocket.EncodeException;
import javax.websocket.CloseReason;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.OnError;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
@ServerEndpoint("/ws/websocket")
public class WebSocketService{
@OnOpen
public void onOpen(Session peer, EndpointConfig config) {
System.err.println("Open");
peer.getAsyncRemote().sendText("Hello");
}
@OnClose
public void onClose(Session peer, CloseReason reason) {
System.err.println("Close");
}
@OnError
public void onError(Session peer, Throwable throwable) {
System.err.println("Error");
}
}