I’m glad you found my example useful. You can convert it into a one-to-one chat system by replacing the to_channel
column in the messages
table with a to_user
column that links to the users
table. Then each message is from a user to another user.
The UI is simple to modify too: Change the ‘Channel’ dropdown to select a user instead. When a user is selected in the dropdown, display the messages from that user to the logged-in user, and from the logged-in user to the selected user.
Then instead of channels, you will have a one-to-one chat history between each pair of users.