Server-based. I'm referring to games like Zynga Texas Hold'em Poker, then a card game.
It is not so easy as you can imagine,
@wonder.
Thinking to a WEB server, you need to use a websocket object, a websocket handler.
You need to decide which object you need; for example, having a websocket handler class, which contains obviously a websocket object, you might decide that this class represents a player but it could be a user, before he chooses a game-room, and he could be a "chatter" if he enters a chat-room. So, you might use a Role type, a simple variable, or you might use different classes (sub classes) for each role and assign the websocket handler OBJECT to them.
There are many BUT many things like this to consider, to establish, to organize.
Just to say, another example of the complexity.
The user chooses a room, GameRoomID; the client sends this ID to the server. At this point, many things have to be made and checked:
a) the availability of the room (in the meantime, another user may have chosen the same room or the room may have changed its status);
b) the position around the table;
c) the order of play;
and
lots of other stuff which is not expected immediately (also, you need to choose what you should save "permanently" (db) and what can be simply stored in memory (property of some class)).
Everything is much more complex than it seems.