Failed to load resource:
net::ERR_CONNECTION_REFUSED?
It means exactly what it says.
You tried to connect to something over the network. The system you were connecting to refused to accept the connection.
Usually this is because there isn't a service listening on the port you tried to connect to. Sometimes the connection is blocked by a firewall.
Related
I just created an EC2 instance for my web server and I run into this whenever i try connecting to it:
This site can’t provide a secure connection
18.170.25.198 sent an invalid response.
ERR_SSL_PROTOCOL_ERROR
Just connect on http, it works for me
http://18.170.25.198:8001/api
I created a self signed certificate and I've been working on the mqtt websockets over SSL/TSL, however I'm unsure exactly where I made an error. On my terminal websocket is open and sends out CONNACK/SUBSCRIBE/PUBLISH etc...
However when I opened up my chrome console log, I got an error saying that
"websocket connection to 'wss:.//hostname:9001/mqtt' failed: Error in connection establishment: net: ERR_CERT_AUTHORITY_INVALID
My time is synchronised correctly, and I'm either thinking my certificate has an error or chrome doesn't accept it but if my certificate error, wouldn't it have given an error when I first tried it on regular mosquitto_sub?
Any tips?
Thank you
I have Web Socket that works perfectly fine on localhost and production (https://www.example.com) environment.
However, when I deploy the same code to pp environment (https://pp.example.com) I get WebSocket handshake: Unexpected response code: 404
I have AWS certificate manager generated certificate for domain example.com, with additional domain name www.example.com and pp.example.com
www.example.com and pp.example.com are sitting on different server so they have different ip addresses.
When I go to www.example.com and make the following call,
let ws = new WebSocket("wss://www.example.com/ws");
It works perfectly fine.web socket is connected.
However, when I switch to pp.example.com and make the following call
let ws = new WebSocket("wss://pp.example.com/ws");
I get error from Safari, Firefox and Chrome:
WebSocket connection to 'wss://pp.example.com/ws' failed: Error during
WebSocket handshake: Unexpected response code: 404
Any ideas?
The code are exactly the same.
They are deployed on aws beanstalk.
production environment is using global accelerator + application load balancer + EC2
pp environment is using classic load balancer + EC2
The problems lies in load balancer's listener.
I was using HTTPS for traffic forwarding, while web socket works on TCP level, therefore, it should be SSL TCP instead.
See the attached screenshot at the following for load balancer
I've done quite a bit of reading around to try and solve this issue but I'm still stuck. My problem is with trying to get the websocket handshake to complete using socket.io client side and flask_socket.io server side.
I can run the flask development server on my local machine using:
app = Flask(__name__)
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
socketio = SocketIO(app)
socketio.run(app)
...
and if I point chrome to localhost:5000 and press the button which I have linked to opening a websocket it works fine and chrome network tab shows status 101.
However on uploading the code to a remote machine and again using flask's development server but changing the port to 80,
socketio.run(app,host='0.0.0.0',port=80)
the websocket handshake stops working and gives status 200 instead.
WebSocket connection to 'ws://example.com/socket.io/?EIO=3&transport=websocket&sid=cfb1949b243b42578fe422782a0db359' failed: Error during WebSocket handshake: Unexpected response code: 200
All websocket messages are now sent over xhr polling instead of inside the websocket frame.
I've followed all of the guides I can find on google relating to this but with no success. I was previously using nginx and gunicorn and followed the advice to change the nginx conf to allow upgrade to websockets but that didn't solve the problem. So I simplified to using the flask development server but I still haven't been able to get a successful handshake.
I found a solution after finding a similar problem posted here https://nolanlawson.com/2013/05/31/web-sockets-with-socket-io-node-js-and-nginx-port-80-considered-harmful/#comment-85425.
It turns out many public wifi networks block websockets when they are running on port 80. However often ports 443 and 8080 are not blocked. You can find out which ports are blocked from this website: http://websocketstest.com/. I just moved the address of my websocket from example.com to example.com:8080.
I ran into a similar problem but due to a different reason. When using flask-socketio you have to install gevent-websocket or else it's going to use long-polling and you'll see a lot of 200 responses. Thus, my solution to that problem was just.
pip install gevent-websocket
I'm trying to get a nodejs socket server running that will allow remote communication between two clients running a Flash game that communicates using a custom protocol. Due to Flash security restrictions, it seems that the socket server must be running on the same host as the web server that servers the Flash game. I've been continuously getting the following error:
The service crashed at startup or is listening to the wrong port. It failed to respond on port "nodejs" (8080) within 30 seconds
What I need is a way to run my nodeJS server code, while simultaneously serve the flash files.
I'm using the environment JSON variables to determine what port to listen on, and my YML is similar to the one discussed here but no luck...
Just wondering if I can get some info on how to create a working socket server/web server that will work for this (or if it is actually possible)
You can use the following dotcloud.yml file:
www:
type: nodejs
ports:
mything: tcp
Then in your Node.js app, you can bind a HTTP server to port 8080, and an arbitrary TCP server to the port contained by environment variable $PORT_MYTHING. Then run dotcloud info on your service; in the ports section, you will see something like this:
- name: mything
url: tcp://myapp-johndoe.dotcloud.com:12345
From now on, if you connect to myapp-johndoe.dotcloud.com on port 12345, you will actually connect to $PORT_MYTHING in your application.
I hope that it makes sense, and that it is what you were looking for!