diff --git a/README.md b/README.md index ddbf62a..ae8961d 100644 --- a/README.md +++ b/README.md @@ -4,47 +4,44 @@ A one-to-one text, audio and video chat application built with webRTC and Ratche # Requirements - PHP >= 5.4 - Composer -- Every other required files are included or referenced as the case may be. + +# Features +- Video call +- Audio call +- Recording +- Text chat +- Two participants only + +If you require more than two participants, check out https://github.com/amir/video-call-app-nodejs. # Getting Started To test this app on your local server: -- The audio and video call is best tested on two different devices. This will require more configurations. - - Open `video-call-app/js/comm.js` and change this line `const wsChat = new WebSocket("ws://localhost:PORT/comm");` to `const wsChat = new WebSocket("ws://YOUR_SERVER_IP:PORT/comm");` - - Open __`video-call-app/ws/bin/server.php`__ and add your server `ip address` to __`$allowed_origins`__ array, then replace the `localhost` and `PORT` in `$app = new Ratchet\App('localhost', PORT, '0.0.0.0');` with your `ip address` and `Port number`respectively. -- The Ratchet server must be running. This can be achieved by navigating to *__video-call-app/ws/bin__* from your cli and run *__php server.php__* -- Run the app from your browser at: `http://localhost/video-call-app/` -- Create a room. -- Enter the room from two different browsers (using the same link) and test by sending text chats. This can be done on the same device. - - Blam! Good to go. Navigate to `YOUR_IP_ADDRESS/video-call-app` on your browser on two different devices to start chatting +- Run `composer install` from the root directory to install dependencies. +- Set your app root (base url) in `/js/config.js`. +- Open __`/ws/bin/server.php`__ and add your `domain name` and/or `ip address` to __`$allowed_origins`__ array, then replace the `localhost` and `PORT` in `$app = new Ratchet\App('localhost', PORT, '0.0.0.0');` with either your `domain name` or `ip address` and `Port number` respectively. +- Set your web socket url in `/js/config.js`. Ensure the `domain name` and `port` matches what you set above. Use `wss` for secured connection. +- Start Ratchet server by executing `php ws/bin/server.php` from your CLI. +- Blam! Good to go. Open the app on two different devices to start chatting. - Works best on Chrome, Firefox and the latest versions of Opera desktop browser. ## Note To host this online, you'll need to set up a few things: -- Create Ratchet as a service so it can run persistently on your server. Check the file *create-ratchet-as-a-service-with-daemon.txt* for the guide on how to do this on CentOS7. +- Create Ratchet as a service so it can run persistently on your server. Check the file *create-ratchet-as-a-service-with-daemon.txt* for the guide on how to do this on linux servers. - If on SSL, Ratchet won't work unless you make some changes on your server. - Enable mod_proxy.so - - Enable mod_proxy_wstunnel.so - - Open your apache config file and add this: __ProxyPass /wss/ ws://YOUR_SERVER_IP_OR_DOMAIN:PORT/__ + - Enable mod_proxy_wstunnel.so + - Open your apache SSL config file and add this: `ProxyPass /wss-secured/ ws://WEB_SOCKET_DOMAIN:WEB_SOCKET_PORT/` - e.g. _ProxyPass /wss/ ws://www.abc.xyz:PORT/_ - - - From your front-end, you can connect like this: - - _const wsChat = new WebSocket("wss://YOUR_SERVER_IP_OR_DOMAIN/wss/comm");_ + e.g. `ProxyPass /wss-secured/ ws://www.abc.xyz:PORT/` - However, if you are wondering how to edit apache config on WHM, here is how: - - After enabling those services (mod_proxy.so and mod_proxy_wstunnel.so), log in to WHM, + Note that you can substitute the `wss-secured` above with any path of your choice but you have to use the same path while connecting from the front-end as shown below. - go to __"service configuration" => "Apache configuration" => "include editor" => "pre main include"__, + - Update your web socket url in `/js/config.js`: - select a version of your choice or choose _"All versions"_. The file name should be _"pre_main_global.conf'_ - - All your new configuration can be written in that textarea without tampering with httpd.conf directly. - The configurations will be loaded on Apache start-up. - - Once you put the Proxypass directive there, restart your server and there you go. + `const wsUrl = 'wss://YOUR_WEB_SOCKET_DOMAIN/wss-secured';` - This [answer on Stack Overflow](https://stackoverflow.com/a/28393526/4522890) should be helpful. - - Please note that Chrome and Firefox (>= 68) will not allow access to media devices except the application is running on SSL. + - Please note that most browsers will not allow access to media devices except the application is running on SSL or localhost (127.0.0.1).