After looking at too many stackeoverflow question i could not find any solution which solve my problem,
i develop application with ratchet websocket.me which is working in my local machine fine with WS//:localhost:8080 but its not working on live (VPS) server here below is the server configuration and requirements,
I am not sure what i am doing wrong look at below code snippet
SERVER CONFIGURATION
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName kosm.online
ServerAlias www.kosm.online
ServerAdmin webmaster@kosm.online
DocumentRoot "/var/www/kosm"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyPass /wss2/ wss://kosm.online:8080
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/kosm.online/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kosm.online/privkey.pem
</VirtualHost>
</IfModule>
CLIENT SITE WEBSOCKET JAVASCRIPT
var token = document.getElementById('userToken').value;
var socket = new WebSocket('wss://kosm.online:8080?token=' + token);
socket.onclose = function(event) {
console.log('connection close');
};
socket.onopen = function(event) {
console.log("Connection established!");
// socket.send('Hello Me!');
};
HERE IS WEBSOCKET SERVER
require dirname( __FILE__ ) . '/vendor/autoload.php';
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Socket;
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Socket()
)
),
8080
);
$server->run();
HERE IS COMPOSER.JSON
{
"autoload": {
"psr-4": {
"MyApp\\": "app"
}
},
"require": {
"cboden/ratchet": "^0.4.3"
}
}