client send pong
This commit is contained in:
parent
9d140b6206
commit
dda1389e42
1 changed files with 14 additions and 1 deletions
|
@ -74,6 +74,16 @@ handleMessage ServerQuit = do
|
|||
}
|
||||
liftIO $ putStrLn "Quitting due to server shutdown"
|
||||
|
||||
handleMessage (Ping id') = do
|
||||
cid <- asks rcClientUUID
|
||||
sock <- asks rcSocket
|
||||
liftIO $ sendMessage
|
||||
( ClientMessage
|
||||
cid
|
||||
(Pong id')
|
||||
)
|
||||
sock
|
||||
|
||||
handleMessage (TickUpdate slice wizard) = do
|
||||
modify' (\st@(StateContainer {}) ->
|
||||
st
|
||||
|
@ -94,7 +104,10 @@ receiveMessage sock queue = do
|
|||
ptr <- mallocArray maxBufferLength
|
||||
bufferLength <- recvBuf sock ptr maxBufferLength
|
||||
rawMsg <- B.pack <$> peekArray bufferLength ptr
|
||||
let msgs = map B8.tail $ init $ B8.split '>' $ B8.fromStrict rawMsg
|
||||
let msgs =
|
||||
if B.length rawMsg < 1
|
||||
then []
|
||||
else map B8.tail $ init $ B8.split '>' $ B8.fromStrict rawMsg
|
||||
mapM_
|
||||
(\msg -> do
|
||||
let mJsonMsg = A.decode' msg
|
||||
|
|
Loading…
Reference in a new issue