Draft for supporting WSS (replaces WS, will need re-working)

This commit is contained in:
Tissevert 2019-11-12 17:39:38 +01:00
parent 9fb130c944
commit 00f85651ca
3 changed files with 10 additions and 5 deletions

View file

@ -29,7 +29,9 @@ executable hannah
, hanafuda , hanafuda
, hanafuda-APILanguage , hanafuda-APILanguage
, mtl , mtl
, network
, text , text
, websockets , websockets
, wuss
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View file

@ -4,11 +4,13 @@ module Config (
, port , port
) where ) where
import Network.Socket (PortNumber)
host :: String host :: String
host = "koikoi.menf.in" host = "koikoi.menf.in"
path :: String path :: String
path = "/play/" path = "/play/"
port :: Int port :: PortNumber
port = 80 port = 443

View file

@ -1,14 +1,15 @@
module Main where module Main where
import Network.WebSockets (ClientApp, runClient) import Automaton (start)
import Control.Monad.Reader (runReaderT) import Control.Monad.Reader (runReaderT)
import Control.Monad.State (runStateT) import Control.Monad.State (runStateT)
import Config (host, port, path) import Config (host, port, path)
import Automaton (start) import Network.WebSockets (ClientApp)
import Wuss (runSecureClient)
bot :: ClientApp () bot :: ClientApp ()
bot connection = runReaderT Automaton.start connection bot connection = runReaderT Automaton.start connection
main :: IO () main :: IO ()
main = main =
runClient host port path bot runSecureClient host port path bot