I'm using websockets on my php-apache website, running on ubuntu. That worked well, until I added a SSL certificate. The certificate was generated using certbot from Let's Encrypt.
Now when I use
var websocket = WebSocket("wss://my_domain:4950/");
Chrome responds with this error : "WebSocket connection to 'wss://my_domain:4950/' failed: WebSocket opening handshake timed out"
I found some answers that I had to add another certificate for websockets, but I'm lost...
I receive an error when i try to "redirect" and https request to http by a stunnel server.
construction:
flask server: serve https which includes an button with a https request to another server (stunnel4).
stunnel: receives the request and redirect it to a local (http) server.
the stunnel server failes by following error:
Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG5[1744]: Service [https] accepted connection from <external_IP>:51874
Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG5[1744]: s_connect: connected <local_IP>:7777
Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG5[1744]: Service [https] connected remote server from <local_IP>:45444
Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG3[1744]: SSL_connect: 1408F10B: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
is it possible that this error caused by my manually (not officially certificatied) created SSL certificates?
flask server --> uses an manual created cert and key file.
stunnel4 uses --> uses an manual created cert and key file (but different to flasks SSL files)
if you know any other methods to "redirect" the https to http, please comment.
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.
I am new to WebRTC and WebSockets and was following this tutorial to create a WebRTC demo project, but I am unable to create a WebSocket connection. I have followed the same steps as mentioned in the project.
His project is running on port 8080 and he mentioned ws://localhost:9090. My project is running on port 8081, but I copied his URL ws://localhost:9090 because I didn't know the significance of 9090 and I received this error and my server is node.js. i changed local host to 8081 as well but then i am getting hand shake error.
WebSocket connection to 'ws://localhost:9090/' failed: Error in
connection establishment: net::ERR_CONNECTION_REFUSED.
Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server).
However the same should work fine with Firefox.
You need to use ws://yourIp:9090/, where yourIP is like 192.168.?.?.
Usually WebRTC requires a secure connection (that is https).
The error you have got is due to TLS/SSL certificates occupied, may be they are not properly configured in your project.
Provide a valid TLS/SSL certificate and also configure it correctly in project, then it will work without the above error.
try to change the port to 8080
const ws = new WebSocket('ws://localhost:8080/chat')
I guess this is a generic websocket issue.
Change the url to a dynamic name using the built-in location.host variable and change the protocol to secure websocket wss if you have set-up the TLS:
const ws = new WebSocket("wss://" + location.host + "/")
Port 9090 is used by reactotron. Probably you are using it in your project and your app cannot connect with reactotron because it is closed. Just open reactotron and the error will disappear.
also you could easily change the mappings of IP addresses to host names,
on windows go to C:\Windows\System32\drivers\etc\hosts and uncomment this line
127.0.0.1 localhost
save and restart.
WebSocket connection to 'ws://localhost:8080/' failed
Must ensure server file is running
I git this above problem
maybe you forgot to start websocket server, check it again, with configuration in my project, run:
php artisan websocket:init
I am hosting my app with Heroku and using websockets. When the browser sends a request the connection fails due to this error message:
Firefox can't establish a connection to the server at wss://shrouded-dawn-5557.herokuapp.com/ws
In my javascript file I create a new websocket object as:
ws = new WebSocket("ws://"+ location.host +"/ws");
Why is this not making the connection to the server.
Thanks
Solved this by enabling websockets in Heroku:
heroku labs:enable websockets -a myapp