WebSocket connection delay without localhost

I am developing WebApp in a company that uses WebSockets. Currently, in the basic "client sends a message, the server responds" -state and works just as it should work ... under the local host.

I use Tomcat 7 and Netbeans to deploy the application. So basically I achieve this under

local: 8080 / webapp

and WebSocket itself refers to

var ws = new WebSocket ("ws: // localhost: 8080 / WebSocketTest / WsSendTest");

If I change "localhost" to my network IP address now, I can still get to the Website, but the functionality seems to be broken. I have a ping button that sends ping-msg to the server. If I quickly click on this, the function seems to be restored. But after F5-ing it broke again.

It is like I am changing the ws: // path to my IP.

It is strange that the onOpen () method is implemented in such a way that it registers the session identifier of any client connecting to WebSocket and immediately recognizes the connection. Is the rest like lagging or blocking?

I will have to use IP, since another ppl on the network cannot repeat ws: // if it is set to localhost on the web page.

Can anyone tie?

+4

Source: https://habr.com/ru/post/1530261/


All Articles