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

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"

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...

Related

django websocket connection failed during web socket handshake in js console

I am trying django channels in my django projects. i have to fetch data from redis server and populate it in a datatable. I tried and established the code in my custom signin page, and the list of objects was printing there without an error. even connection had no error.
but when i tries to connect it after logged in . it shows this error below in console.
WebSocket connection to 'ws://localhost:8000/ws/data/' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET

Error during WebSocket handshake Unexpected response code 400

I am setting up a node js cloud server and I am using io sockets. When I do (in front):
const socket = io('wss://********.fr', {transports: ['websocket']});
I have this error :
WebSocket connection to 'wss://********.fr/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
My site is in https and on my local machine I did not have this error.
I can't find a solution, have you got an idea ?
Théo

AWS websocket server: 403 error when connecting from browser, fine from Python

I deployed a websocket server on an AWS EC2 instance. I am able to connect to this websocket without any issues from a Python script (using websocket.create_connection), but I get a 403 error when running the Javascript line var ws = new Websocket(.....) in Chrome: Error during WebSocket handshake: Unexpected response code: 403.
I made sure to change the security group on the EC2 instance to allow all inbound and outbound traffic.
All suggestions appreciated!
EDIT: Figured out what was going on here. It was an issue with the default origin check function in my Go websocket server.
This was a server-side issue with the gorilla/websocket package. Had to add this CheckOrigin function:
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {return true},
}

Websocket connection refused. WebSocket connection to 'ws://127.0.0.1:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

I have used websocket: https://github.com/kishor10d/CodeIgniter-Ratchet-Websocket
I have implemented websocket on a site. It is working great on localhost but when I uploaded files, it doesn't work. First there was confusion regarding the port I am using which is 2000. Now after contacting Inmotion's support they told me that 2000 is live and there are no firewall issues.
But I get this error when I reload the page:
WebSocket connection to 'ws://127.0.0.1:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
According to their support there is no service listing to this port.
I have used CodeIgniter, Javascript
If you're calling the localhost (127.0.0.1) from the client app, you're calling your own computer, once you have the backend running on a remote server, you have to use the server's domain name or IP address - I'd suppose your web/server hosting service (Inmotion) assigned you the latter.

javascript - Error during WebSocket handshake: Unexpected response code: 404

I am using webRTC for web to web calling. I got a reference from https://github.com/fycth/webrtcexample/tree/master/www. I upload it to the https server but it shows me an error in console
WebSocket connection to 'wss://myserver.com/signalling' failed: Error during WebSocket handshake: Unexpected response code: 404
please let me know how to solve this.
Thanks
most probably signalling server is not on up or running state.
you can check your connection via :https://www.websocket.org/echo.html

Categories

Resources