Answer the question
In order to leave comments, you need to log in
How to make socket.io work over https?
Hello, how to make socket.io work over https protocol?
There is a separate machine where nodeJS is installed.
I bought an SSL certificate, but there was a problem with WS, because the call went over the http protocol.
var socket = io.connect('http://24.190.11.201:8047', {'reconnection': true});
Answer the question
In order to leave comments, you need to log in
If you have WebSockets, then why do you write http?
For port 80, write ws://... for 443 with wss:// encryption, for the other you specify explicitly.
Something like wss://24.190.11.201:8047
For some reason http is written in the dock, so try https once you have a certificate.
The only question is how your server is configured, and whether it is generally correct.
If you need encryption - I would advise you to install Nginx, it will work with certificates and other things from its area of responsibility, and your application will work with its own part.
In the Nginx config add something like this:
location ~ ^/WebSockets$ {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question