here's my Ratchet server file
<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use ChatWebSocket\Application;
require 'Application.php';
require __DIR__ . '/vendor/autoload.php';
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Application()
)
),
2020
);
$server->run();
And this is Client side using WS Javascript to connect
(function(){
var conn = new WebSocket('wss://mydomain.net:2020');
conn.onopen = function(e) {
console.log("Connection OK!");
};
conn.onmessage = function(e) {
var res = JSON.parse(e.data);
alert(res);
};
})();
when i turn off SSL mode (http:// connect) and using ws://mydomain.net:2020
then the server works fine!
And when i turn on SSL mode, connect to server with wss://mydomain.net:2020
, go to client web with https://
then i get this error from console
WebSocket connection to 'wss://mydomain.net:2020/' failed: WebSocket opening handshake timed out
i've tried add this setting to my httpd.conf
file
ProxyPass /wss2/ ws://mydomain.net:2020/
but i got same error.
how can i fix this error? how to connect websocket with SSL (https://) ?