Implementing the chat application
After this short introduction in the development with WebSockets, let us now begin implementing the actual chat application. The chat application will consist of the server-side application built in PHP with Ratchet, and an HTML and JavaScript-based client that will run in the user's browser.
Bootstrapping the project server-side
As mentioned in the previous section, applications based on ReactPHP will achieve the best performance when used with an event-loop extension such as libevent
or ev
. Unfortunately, the libevent
extension is not compatible with PHP 7, yet. Luckily, ReactPHP also works with the ev
extension, whose latest version already supports PHP 7. Just like in the previous chapter, we'll be working with ...
Get PHP 7 Programming Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.