A simple PHP chat socket server made with Ratchet, for your website.
- A user visits the conversation page on your website.
- Upon loading, the client requests encrypted authentication details from your website for the socket server to verify the connection.
- A web socket is created on the client side, which sends a connection request to the server, including the authentication details as a query parameter.
- The socket server decrypts and validates the authentication details.
- If valid, the server creates a new chat room (if it doesn't already exist) using the chat ID from the authentication details, and adds the user with their user ID and connection to the room.
- When a second participant joins the conversation, they request a connection with their authentication details. If valid, they are connected to the existing room using their user ID and connection.
- When a participant sends a message, the socket server identifies the room associated with the authenticated connection, saves the message to your website's database, and then forwards the message to the other participant in the room.
- Upon receiving the message from the socket server, the client-side socket executes a method to display the live message in the conversation.
- Add code examples to README.md
- Add deployment guide to README.md