1import ProjectM36.Server.WebSocket
2import ProjectM36.Server.Config
3import ProjectM36.Server.ParseArgs
4import ProjectM36.Server
5import Control.Concurrent
6import qualified Network.WebSockets as WS
7import Network.Transport.TCP (decodeEndPointAddress)
8import Control.Exception
12 -- launch normal project-m36-server
13 addressMVar <- newEmptyMVar
14 serverConfig <- parseConfigWithDefaults (defaultServerConfig { bindPort = 8000, bindHost = "127.0.0.1" })
15 --usurp the serverConfig for our websocket server and make the proxied server run locally
16 let wsHost = bindHost serverConfig
17 wsPort = bindPort serverConfig
18 serverHost = "127.0.0.1"
19 serverConfig' = serverConfig {bindPort = 0, bindHost = serverHost}
20 _ <- forkFinally (launchServer serverConfig' (Just addressMVar) >> pure ()) (either throwIO pure)
21 --wait for server to be listening
22 address <- takeMVar addressMVar
23 let Just (_, serverPort, _) = decodeEndPointAddress address
24 --this built-in server is apparently not meant for production use, but it's easier to test than starting up the wai or snap interfaces
25 WS.runServer wsHost (fromIntegral wsPort) (websocketProxyServer (read serverPort) serverHost)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list