diff --git a/src/Messaging.hs b/src/Messaging.hs index 5545565..a4bd1b6 100644 --- a/src/Messaging.hs +++ b/src/Messaging.hs @@ -27,7 +27,7 @@ import Hanafuda.Message (FromClient(..), T(..)) import qualified Hanafuda.Message as Message (T) import Network.WebSockets (receiveData, sendTextData) import Player (playerID, showDebug) -import qualified Server (T(..), sessionsWhere) +import qualified Server (sessionsWhere) import qualified Session (T(..)) sendToSessions :: [Session.T] -> Message.T -> App.T () @@ -52,7 +52,9 @@ send obj = do broadcast :: Message.T -> App.T () broadcast obj = do - App.get (elems . Server.sessions) >>= flip sendToSessions obj + App.get (concat . elems . allSessions) >>= flip sendToSessions obj + where + allSessions = Server.sessionsWhere (\_ _ -> True) relay :: FromClient -> (Message.T -> App.T ()) -> App.T () relay message f = do