ng-websocket. Error during WebSocket handshake: Unexpected response code: 400 - javascript

I'm having a problem with Web Socket. I use ng-websocket and when it all works great when I'm testing on my PC with the URL ws://localhost:8080//connectToGame. But then I published web-app on domain and got this error:
Error during WebSocket handshake: Unexpected response code: 400
ws://lotteryskins-net.1gb.ru/connectToGame
What am I doing wrong and how can I fix it? The server works on Apache.

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

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

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},
}

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