To install Ratchet, add the following line to the "require"
section of the composer.json
file found in the root of your Elefant site:
"cboden/Ratchet": "0.2.*"
The section should look like this:
"require": {
"php": ">=5.3.2",
"cboden/Ratchet": "0.2.*"
}
More info on installing Ratchet is available here.
Next, create the following files based on the ones found in this gist:
apps/chat/handlers/run.php
apps/chat/lib/Server.php
These are based on Ratchet's Hello World example found here.
To run the server, use the following command:
php index.php chat/run
To connect to the server, open two new terminal windows and enter this into both:
telnet localhost 8080
In each of the telnet connections, anything you type should appear in the other window. From here, follow the next steps in the Ratchet documentation for more advanced usage.