I'm trying to use stunnel with wss on my site but when I try to connect I always get:
WebSocket connection to 'wss://www.soinfit.com:8443/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
My socket is running on port 8080 as this:
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;
require dirname(__DIR__) . '/vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
)
),
8080
);
$server->run();
My stunnel config is:
debug = 4
output = /var/log/stunnel4/websocket.log
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
cert = /etc/ssl/private/47f2ad52d70c0.crt
key = /etc/ssl/private/soinfit.key
[websocket]
accept = 8443
connect = 8080
I'm using Chrome to connect and I'm using this code:
try {
conn = new WebSocket('wss://www.soinfit.com:8443');
conn.onclose = function (e) {
}
conn.onopen = function(e) {
console.log("test");
};
} catch (error) {
console.log(error);
}
There is nothing in the log file. What am I doing wrong? Thanks.