2023-01-27 18:34:28 +01:00
|
|
|
{-# LANGUAGE DerivingVia #-}
|
|
|
|
|
2023-01-15 16:38:57 +01:00
|
|
|
module Lib
|
2023-01-15 18:26:41 +01:00
|
|
|
( runBothServers,
|
|
|
|
)
|
|
|
|
where
|
2023-01-15 16:38:57 +01:00
|
|
|
|
2023-01-15 18:26:41 +01:00
|
|
|
import ClassyPrelude
|
2023-01-27 18:34:28 +01:00
|
|
|
import Types.AppTypes
|
2023-01-27 19:53:34 +01:00
|
|
|
import Types.ConnectionState (initConnectionsState)
|
|
|
|
import Types.RoomsState (initRoomsState)
|
2023-01-15 18:26:41 +01:00
|
|
|
import WebServer (runWebServer)
|
2023-02-19 11:41:32 +01:00
|
|
|
import WebSocket.Server (runWebSocketServer)
|
2023-01-15 16:38:57 +01:00
|
|
|
|
2023-01-15 18:26:41 +01:00
|
|
|
runBothServers :: IO ()
|
|
|
|
runBothServers = do
|
2023-01-27 19:53:34 +01:00
|
|
|
connectedClientsState <- initConnectionsState
|
|
|
|
roomsState <- initRoomsState
|
2023-01-27 18:34:28 +01:00
|
|
|
|
|
|
|
let env =
|
|
|
|
Env
|
|
|
|
{ connectedClientsState = connectedClientsState,
|
2023-01-27 19:53:34 +01:00
|
|
|
profile = Dev,
|
|
|
|
roomsState = roomsState
|
2023-01-27 18:34:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_ <- concurrently (unApp runWebSocketServer env) (unApp runWebServer env)
|
2023-01-15 18:26:41 +01:00
|
|
|
return ()
|