#How do i store the "clients" in a server

18 messages · Page 1 of 1 (latest)

shy ironBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

agile path
#

Use a map

#

Then just map the username to client data in the map

#

On connection, insert connection data to the map, on disconnect, remove it

#

The approach isn't really scalable, but it's a quick and dirty way to do it

#

Why does the client need to be in a list?

#

You definitely don't want to store the row number in the map

#

why not just use the map?

#

you can get the values from the map

#

why do you need the row number?

#

But why not just store the UUID/username of the client in the row?

#

So you can then just take that in your callback and look it up in the map, and remove it

#

No need for the client struct to know about the row

#

Seriously recommend checking on SOLID design principles

#

Things should be very limited in scope in what they do and what they know

#

Correct

#

You should be able to sum up what it does in one sentence