Real-Time (one to one ) chat application using Ratchet — PHP WebSockets

Harendra Verma
Feb 25, 2019 · 2 min read

Today I am with a real-time chat application using PHP WebSockets. This application provides private chat with multiple users in real time.

Introduction to WebSockets

WebSockets is a bi-directional, full-duplex, persistent connection from a web browser to a server. Once a WebSocket connection is established the connection stays open until the client or server decides to close this connection. With this open connection, the client or server can send a message at any given time to the other. This makes web programming entirely event driven, not (just) user initiated. It is stateful. As well, at this time, a single running server application is aware of all connections, allowing you to communicate with any number of open connections at any given time.

To learn more click here

Real-Time (one to one )time chat application using Ratchet — PHP WebSockets


  1. Clone the repository from Github using — “git clone
  2. Place the cloned folder to your local server.
  3. Now open cmd in this in the cloned directory and run — “composer install”
  4. Then change directory to bin folder by — “cd bin”
  5. Stat-server by — “php chat-server.php”
  6. Now hit public folder of the project by your browser — “localhost/path_to_your_folder/public”
  7. Enjoy!





Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade