User List + Other rooms
I'm trying to create multiple chatrooms using tcp java. i have two questions, was wondering how i would be able to display the users in the room e.g. type a key word to display who is there.
The second thing is i want to make it so there is multiple rooms for the user to pick from how could i do these two things in the simplest way?
I would model the room and the people chatting in the room as objects. Then you can pass people objects from client to client using object serialization. All the info about a client can be stored in the client object and retrieved by the other clients on the other end directly. When I implemented an IRC client/server, I kept the connected client list on the server and pushed it to each client as they connected. When a new user would connect or one would leave, I'd send a message to the server which then relayed a connect or disconnect message to each client.