Package it.polimi.ingsw.Server
Class LobbyServer
java.lang.Object
it.polimi.ingsw.Server.LobbyServer
- All Implemented Interfaces:
Runnable
Handler of game events, responsible for communication of game related information with a single client.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumRepresents the various stages of the connection between client and server -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockingQueue<ClientEvent>private final SocketWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static UUIDgenerates a unique UUID for a lobbyprivate BlockingQueue<ClientEvent>Get the event queue this server listens onvoidrun()When run, polls for events from the client and sends appropriate responses while handling interactions with the gamestatic voidspawn(SocketWrapper socketWrapper) Start a server on the provided socket wrapper
-
Field Details
-
lobbyMap
-
connectedNicknames
-
sw
-
eventQueue
-
-
Constructor Details
-
LobbyServer
Creates the server around aSocketWrapper- Parameters:
sw- the socket to use to communicate with the client
-
-
Method Details
-
spawn
Start a server on the provided socket wrapper- Parameters:
socketWrapper- the wrapped connection to the client of the server
-
getEventQueue
Get the event queue this server listens on- Returns:
- the
BlockingQueue<ClientEvent>linked to this server
-
run
public void run()When run, polls for events from the client and sends appropriate responses while handling interactions with the game -
generateUUID
generates a unique UUID for a lobby- Returns:
- a not yet in use UUID for the lobby
-