forest/server/Main.hs
Joscha 6d6344d372 [server] Add ForkModule for combining other modules
This one has some interesting code in its constructor, using the Cont monad
because of the way the ModuleConstructor is structured.
2020-02-12 00:38:29 +00:00

29 lines
722 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Network.WebSockets as WS
import Forest.Server
import Forest.Node
import Forest.TreeModule.ConstModule
import Forest.TreeModule.ForkModule
pingDelay :: Int
pingDelay = 10
pongDelay :: Int
pongDelay = 3 * pingDelay
options :: WS.ServerOptions
options = WS.defaultServerOptions
{ WS.serverRequirePong = Just pongDelay
}
main :: IO ()
main = do
putStrLn "Starting server"
WS.runServerWithOptions options $ serverApp pingDelay $ forkModule "Forest"
[ ProngConstructor $ constModule $ newNode "" "Test" [txtNode "" "Bla"]
, ProngConstructor $ constModule projectDescriptionNode
]