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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 yourserver.rb
code block (I peeked at the source in your GH repo to check 🙃)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.