@esteban-constante
insecure web-sockets doesn't work with secure network(https) 
Nginx 
server {
listen 443 ssl;
ssl on;
blah blah blah...
location = /socket {
proxy_pass http://socket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
}
}
upstream socket {
server 127.0.0.1:27960;
}
Apache 
enable these modules:
-
mod_proxy.so
-
mod_proxy_wstunnel.so
Add this in VirtualHost File:
ProxyPass /wss2/ ws://domain.com:port_number/
Use this URL in your JavaSscript call when you want a WSS connection:
var ws = new WebSocket("wss:/socket_url.mydomain.org/wss2/NNN");
Note: Change domain, IP and ports as per your server configuartions.