Jump to content


Member Since 15 Aug 2019
Offline Last Active Nov 22 2019 01:37 PM

Topics I've Started

Java Websocket Connection Failure

09 November 2019 - 11:45 PM



I've finally been granted Java support on my account, and so today I tried to test out my website/game on it. I'm very new to websites, domains, etc. so my knowledge of all this is limited. That being said I've worked on my website/game for a while now, and I know it works as I have tested it on my computer.



My game uses a websocket from the client side to connect to the Java websocket endpoint. I use:


new WebSocket("ws://localhost:443/Hide/Server/ANY")


...on the client side to do this. "localhost" is used because this is being tested on Tomcat on the same computer; "443" because while I can set this to any number (which I have tested), it seems like the best port I could use for a non-secured connection; "Hide" is the project folder name; "Server/ANY" is the server endpoint. I've tested this many times and it works.



Now to move the project/WAR file (WAR file is called "Hide-1.war") to HelioHost, I first changed the Websocket URL to:


new WebSocket("ws://hhdavidh.heliohost.org/Hide/Server/ANY")


I then uploaded the WAR file and deployed it. However, when I go to the URL where it's deployed at (http://hhdavidh.heliohost.org/Hide-1/) I get:


WebSocket connection to 'ws://hhdavidh.heliohost.org/Hide/Server/ANY' failed: Error during WebSocket handshake: Unexpected response code: 404



I've tried port "8080" as well as other port numbers. I've tried changing the websocket URL to:


new WebSocket("ws://hhdavidh.heliohost.org/Hide-1/Server/ANY")

new WebSocket("ws://hhdavidh.heliohost.org/Server/ANY")

new WebSocket("ws://hhdavidh.heliohost.org:8080/Hide/Server/ANY")



...which all come up with the same error.



When trying:


new WebSocket("ws://hhdavidh.heliohost.org:443/Hide/Server/ANY")


...the error is instead:


WebSocket connection to 'ws://hhdavidh.heliohost.org:443/Hide/Server/ANY' failed: Connection closed before receiving a handshake response



I've tried everything I can think of but now I'm stuck. Any help is appreciated!