From 00f85651ca24101576ffdb54841827c5d2038c1f Mon Sep 17 00:00:00 2001 From: Tissevert Date: Tue, 12 Nov 2019 17:39:38 +0100 Subject: [PATCH] Draft for supporting WSS (replaces WS, will need re-working) --- hannah.cabal | 2 ++ src/Config.hs | 6 ++++-- src/Main.hs | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hannah.cabal b/hannah.cabal index f8b9360..31d33da 100644 --- a/hannah.cabal +++ b/hannah.cabal @@ -29,7 +29,9 @@ executable hannah , hanafuda , hanafuda-APILanguage , mtl + , network , text , websockets + , wuss hs-source-dirs: src default-language: Haskell2010 diff --git a/src/Config.hs b/src/Config.hs index f6cad11..8e77279 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -4,11 +4,13 @@ module Config ( , port ) where +import Network.Socket (PortNumber) + host :: String host = "koikoi.menf.in" path :: String path = "/play/" -port :: Int -port = 80 +port :: PortNumber +port = 443 diff --git a/src/Main.hs b/src/Main.hs index 92238a4..6992ae2 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,14 +1,15 @@ module Main where -import Network.WebSockets (ClientApp, runClient) +import Automaton (start) import Control.Monad.Reader (runReaderT) import Control.Monad.State (runStateT) import Config (host, port, path) -import Automaton (start) +import Network.WebSockets (ClientApp) +import Wuss (runSecureClient) bot :: ClientApp () bot connection = runReaderT Automaton.start connection main :: IO () main = - runClient host port path bot + runSecureClient host port path bot