I wrote a php websockets server using the library Ratchet that I call with javascript using the websocket object.
Everything worked perfectly locally but it was impossible to run my project on my Debian server under apache.
To enable websocket connections I read that I have to use mod_proxy_wstunnel module. So I rewrite my apache conf for my subdomain api.domain.com
like this:
<VirtualHost *:80>
ServerAdmin admin@admin.admin
DocumentRoot /var/www/api.domain.com
ServerName api.domain.com
# Enable Websocket connections on port 8888
ProxyPass "/wss/homews/" "ws://api.domain.com:8888/"
<Directory /var/www/api.domain.com>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Satisfy all
</Directory>
</VirtualHost>
Then I call my php script with this code insight that start Ratchet websocket server:
// ...
// Some code ...
$app = new Ratchet\App('localhost', 8888);
$app->route('/wss/homews/', $myClass, array('*'));
$app->run();
Then when I try to connect to it on the javascript client side with the url ws://api.domain.com:8888/wss/homews/
I always get Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
.
Do you have any ideas how I could debug this type of error ? Are there any logs on apache showing a bad configuration?
from websockets connections fail with apache and Ratchet
No comments:
Post a Comment