Can WebSockets and HTTP server work on SAME port number?

I am using a GlassFish server where index.html sends the control to a servlet file that sends the control to the next nextStep.html file that works with WebSockets. I am confused now, as I get the error message:

Failed to connect to WebSocket to "LocalHost-link": connection error: net :: ERR_CONNECTION_REFUSED

I think this problem is related to port numbers. Can we use both WebSockets and an HTTP server on the same port, if so, how? If we need to use different ports, then how to perform this task in Java?

+6
source share

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


All Articles