DEV Community

Discussion on: Create a chat in the command line with Ruby

Collapse
shanesc profile image
Shane Mitchell • Edited on

Neat! I've been meaning to check out Ruby, I might give this project a shot once I've learned some of the basics.

One thing, I think the Thread.new block is missing from your server.rb code block (I peeked at the source in your GH repo to check 🙃)

Collapse
aurelieverrot profile image
Aurelie Verrot Author • Edited on

Thank you for your comment!
In server.rb the thread is created inside the loop. We need one thread per client.
Many things can be perfected, for example what the user types is seen two times since the method announce_to_everyone sends the message to all clients. Also there is no exception handling when a client quits the chat or when the server is stopped, it can be a great addition.