I have installed Ratchet websocket through for my website that is under https:
php ~/composer.phar require cboden/ratchet
then I have set the bin/server.php:
[...] class Chat
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Chat()
)
),
8888
);
$server->run();
then I have enabled mod_proxy.so and mod_proxy_wstunnel.so:
root@ubuntu:~# a2enmod proxy_http
root@ubuntu:~# sudo a2enmod proxy_wstunnel
root@ubuntu:~# sudo service apache2 restart
After that I changed the file /etc/apache2/sites-available/000-default-le-ssl.conf and added this line:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ProxyPass /wss2/ ws://mywebsite.org:8888/
...
And runned this:
sudo a2ensite default-ssl.conf
sudo service apache2 restart
After that I started the server:
php bin/server.php
And now I connected in the webpage that has this socket connection:
const ws = new WebSocket('wss://mywebsite.org/wss2/?1b70ee9e56888665cfbde77ec832de8a');
But I obtain the title error. In localhost environment I don't have any error and the app works