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
Modifier and TypeClassDescriptionprivate static enum
Represents the various stages of the connection between client and server -
Field Summary
Modifier and TypeFieldDescriptionprivate final BlockingQueue<ClientEvent>
private final SocketWrapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static UUID
generates a unique UUID for a lobbyprivate BlockingQueue<ClientEvent>
Get the event queue this server listens onvoid
run()
When run, polls for events from the client and sends appropriate responses while handling interactions with the gamestatic void
spawn
(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
-