How to Quickly Build a Chat App with Ratchet
WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user’s browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
WebSockets allow us to write applications that can pass data from the browser to the server and vice-versa in real-time.
First, let’s install Ratchet using Composer:
composer require cboden/ratchet
Building the App
Now we’re ready to build the app. Create a
Chat.php file under the
class/ChatApp directory. This would be a class under the
ChatApp namespace, and it would use use Ratchet’s
MessageComponentInterface is used as the basic building block for Ratchet applications, while the
ConnectionInterface represents the connection to the application.
Continue reading %How to Quickly Build a Chat App with Ratchet%