2import ProjectM36.Server.WebSocket
3import ProjectM36.Server.Config
4import ProjectM36.Server.ParseArgs
5import ProjectM36.Server
6import Control.Concurrent
7import qualified Network.WebSockets as WS
9#if MIN_VERSION_network_transport_tcp(0,6,0)
10import Network.Transport.TCP.Internal (decodeEndPointAddress)
12import Network.Transport.TCP (decodeEndPointAddress)
15import Control.Exception
19 -- launch normal project-m36-server
20 addressMVar <- newEmptyMVar
21 serverConfig <- parseConfigWithDefaults (defaultServerConfig { bindPort = 8000, bindHost = "127.0.0.1" })
22 --usurp the serverConfig for our websocket server and make the proxied server run locally
23 let wsHost = bindHost serverConfig
24 wsPort = bindPort serverConfig
25 serverHost = "127.0.0.1"
26 serverConfig' = serverConfig {bindPort = 0, bindHost = serverHost}
27 _ <- forkFinally (launchServer serverConfig' (Just addressMVar) >> pure ()) (either throwIO pure)
28 --wait for server to be listening
29 address <- takeMVar addressMVar
30 let Just (_, serverPort, _) = decodeEndPointAddress address
31 --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
32 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