Websocket failed: error net::err_connection_refused

0
484
Websocket failed: error net::err_connection_refused

Here we can see, “Websocket failed: error net::err_connection_refused”

Websocket Error in connection establishment: net::ERR_CONNECTION_REFUSED ‘wss://’

I asked this particular question in StackOverflow; however, it looks like a server problem over coding difficulty. I’m developing a job with Java EE, and I’ve got access to the host computer below a college LAN. Merely to provide details, I also put in my testimonials below.

I am attempting to link to the host through WebSockets just on a single page.

My client websocket:

var socket = new WebSocket("wss://serverName:8181/projectName/actions");

Java Server Endpoint:

/actions

The URL at which WebSocket can be utilized has this arrangement:

https://serverName/projectName/pageName.xhtml

My context root exactly the like the name. Security limitations in web.xml document:

<security-constraint>  
    <web-resource-collection>  
        <web-resource-name>SecureResource</web-resource-name>  
        <url-pattern>/projectName/*</url-pattern>  
        <http-method>GET</http-method>
        <http-method>POST</http-method> 
    </web-resource-collection>  
    <user-data-constraint>  
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>  
    </user-data-constraint>  
</security-constraint>

I utilize Glassfish Program Server 4.1. The host has two Entrance listeners. About listeners:

Http-Listener-1: listens port 8080, safety Isn’t allowed, WebSocket service Isn’t enabled

Http-Listener-2: listens port 8181, safety is empowered, WebSocket is permitted

SSL3 and TLS is Enabled in most of these. I’m giving the host details since I’m a newcomer about the host problems so that I dont know if those details are significant. Also, I run these commands while looking for a fix. But these controls May Not be associated:

asadmin set server.network-config.protocols.protocol.http-listener-1.http.scheme-mapping=X-Forwarded-Proto
asadmin set server.network-config.protocols.protocol.http-listener-2.http.scheme-mapping=X-Forwarded-Proto

My connections work on HTTPS with no problem. Nonetheless, on the page in which I utilize the WebSocket, I receive this error:

WebSocket connection to ‘wss://serverName:8181/projectName/actions’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Also See:  Android Camera Switches uses your face to control your phone

I’ve tried a great deal of different strategy. Additionally, I attempted the WebSocket URI with no interface number. Everything had worked good earlier. We had a digital certificate to the host computer. I used’s rather than WSS back, and that I didnt have the safety constraints from the web.xml file. But, I’m unable to give a WebSocket link under HTTPS following many efforts and reading.