Example PHP WebSocket server and PHP WebSocket client
Based on socketo.me
- If you don't have Composer yet, just run the following command:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
- Checkout project from GitHub
cd <path-to-install>
git init
git remote add origin https://github.com/vakst/ws.git
git pull origin master
- Use the "composer install" command to install dependencies
composer install
- Launch web-server
php -S 0.0.0.0:80 -t www
- Launch ws-server
php bin/messenger-server.php
php bin/messenger-client.php get-all-users
php bin/messenger-client.php get-all-user-task=USERID
php bin/messenger-client.php send-message=USERID task=TASKID message=MESSAGE
php bin/messenger-client.php send-message=USERID message=MESSAGE
php bin/messenger-client.php send-message=all message=MESSAGE