jhaubrich.com
jhaubrich.com

Reputation: 89

Websocket : Error during WebSocket handshake: Unexpected response code: 504

I have been developing a live chat that uses a websocket connection. It works fine on my localhost and on http servers. However, I am trying to get it working on a secure GoDaddy server with Deluxe Linux Hosting. While the client is trying to open a websocket connection from javascript, it eventually responds with "WebSocket connection to 'wss://jhaubrich.com/new.projecthandle.io/Demo/include/projectChat/php-socket.php?username=Justin' failed: Error during WebSocket handshake: Unexpected response code: 504"

A 504 Gateway Timeout Error indicates an issue with the gateway or proxy server.

If I try to open the connection again without killing the PID for the lsphp, the error written to error_log by the php-socket.php file reads "PHP Warning: socket_bind(): unable to bind address [98]: Address already in use in /home/fq2cvob2t06k/public_html/new.projecthandle.io/Demo/include/projectChat/php-socket.php on line 12"

For the socket_bind() in php-socket.php I am using port 8090.

I have tried changing ports. I have tried adding 'websocket' to the end of the url in the websocket js.

//my js to initiate the websocket var websocket = new WebSocket("ws://jhaubrich.com/new.projecthandle.io/Demo/include/projectChat/php-socket.php?username=" + userName + "" );

I expected a websocket connection to be made. Instead I get this error : "WebSocket connection to 'wss://jhaubrich.com/new.projecthandle.io/Demo/include/projectChat/php-socket.php?username=Justin' failed: Error during WebSocket handshake: Unexpected response code: 504"

Upvotes: 1

Views: 7294

Answers (1)

jhaubrich.com
jhaubrich.com

Reputation: 89

I came to the realization that I am use a shared hosting environment. I need to purchase a Virtual Private Server where I will have root privileges. Then I will be able to use WebSockets...

Upvotes: 1

Related Questions