From b2bd1d4e1d5cdd87ce1eabd6e250e7a8584c617f Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 23 Jan 2024 16:27:12 +0100 Subject: [PATCH] prepare synchronisation primitives --- src-lib/Library/Types/Communication.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src-lib/Library/Types/Communication.hs b/src-lib/Library/Types/Communication.hs index b576373..73c559c 100644 --- a/src-lib/Library/Types/Communication.hs +++ b/src-lib/Library/Types/Communication.hs @@ -14,9 +14,6 @@ import Library.Types.Map data ServerMessage = ServerQuit -- ^ Message notifying a client that the server is about to shut down. - | Ping -- ^ A servers's heartbeat request - { pingID :: UUID -- ^ The random ID of the heartbeat request. NOT THE CLIENT'S 'UUID'! - } | AcceptClient -- ^ Message notifying the client of being accepted and providing it's -- newly registered 'UUID' { acClientUUID :: UUID @@ -24,6 +21,9 @@ data ServerMessage | ProvideInitialWizard -- ^ Message containing a newly created player character { initWizard :: Wizard } + | Ping -- ^ A servers's heartbeat request + { pingID :: UUID -- ^ The random ID of the heartbeat request. NOT THE CLIENT'S 'UUID'! + } | TickUpdate -- ^ The Server's state update to the clients { tuMapSlice :: MapSlice -- ^ The player's field of vision , tuWizard :: Wizard -- ^ the player's updated character @@ -39,6 +39,9 @@ data ClientMessagePayload | ClientRequestWizard -- ^ Message for requesting a new player character | ClientReady -- ^ Message requesting the server to position the client's character on the -- map + | Pong -- ^ A client's reply to a heartbeat request + { pongId :: UUID -- ^ The 'UUID' of the original heartbeat request + } deriving (Eq, Show, Generic) data ClientMessage