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
Related
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...
I use express and socket.io
My node server is running on 127.0.0.1:3000
and i have connected it
var socket = io.connect('http://127.0.0.1:3000', {query: 'id=' + user.id});
There is a warning in my browser console.
WebSocket connection to 'ws://127.0.0.1:3000/socket.io/?id=ecad7e1a009eb4f943ead0b4db8d62c4&EIO=3&transport=websocket&sid=0RMaRoZb7U67td_2AAAD' failed: Invalid frame header
Also it runs well. There is no problem :). But i wondered.
Maybe you should check versions of socket client and server. They should be the same.
I use Python 3.5, Flask and Meinheld web socket middleware to serve sockets. Here is server side code sample:
#app.route('/chat')
def chat():
ws = request.environ.get('wsgi.websocket')
while True:
m = ws.wait()
if m is None:
break
ws.send(m)
return ""
Client side code sample:
var s = new WebSocket("ws://localhost:4567/chat");
However, everything works properly while I run it in local mode, but when i add this into docker container i always get error like this:
WebSocket connection to 'ws://localhost:4567/chat' failed: Error during WebSocket handshake: Unexpected response code: 500
It does not matter where docker container is run, on remote server or local environment, the error is always the same. All necessary ports are exposed.
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
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.