Reputation: 1702
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");
}
}
Upvotes: 0
Views: 920
Reputation: 4035
WildFly port on OpenShift should be 8080, not 8000 as you mentioned.
Are you able to connect to localhost:8080 and redirected to your OpenShift instance ?
Does Chrome Developer Tools show any errors ?
Upvotes: 2