javawebsocketwildflyjava-websocketwildfly-11

Wildfly URI for Websocket Client


Hey I am struggeling to connect my Client to my WebSocketEndpoint, I installed Wildfly 11 and it's running at

localhost:9990

The problem is to connect to my Endpoint I need an URI which follows the rules

"ws://"+hostname+":"+port+url

I know my url is defined at the Endpoint but how do I deploy my Endpoint to Wildfly and whats the URI then?


Solution

  • To create a new WebSocket in your client where hostname is "localhost" and port is "9990", the JavaScript would be:

    var socket = new WebSocket('ws://localhost:9990');
    

    If your WebSocket server is not on the default route (/) you need to indicate the path:

    var socket = new WebSocket('ws://localhost:9990/your/websocket/server');