File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ library
77
77
, ansi-terminal >= 0.6 && < 1.0
78
78
, unordered-containers >= 0.2 && < 1.0
79
79
, random >= 1.0 && < 2.0
80
- , wai >= 2.0 && < 3.0
81
- , warp >= 2.0 && < 3.0
80
+ , wai >= 3.0 && < 4.0
81
+ , wai-conduit >= 3.0 && < 4.0
82
+ , warp >= 3.0 && < 4.0
82
83
, http-types >= 0.8 && < 1.0
83
84
, mtl >= 2.1 && < 3.0
84
85
, transformers-base >= 0.4 && < 1.0
@@ -110,11 +111,12 @@ test-suite socketio-test
110
111
, ansi-terminal >= 0.6 && < 1.0
111
112
, unordered-containers >= 0.2 && < 1.0
112
113
, random >= 1.0 && < 2.0
113
- , wai >= 2.0 && < 3.0
114
- , warp >= 2.0 && < 3.0
114
+ , wai >= 3.0 && < 4.0
115
+ , wai-conduit >= 3.0 && < 4.0
116
+ , warp >= 3.0 && < 4.0
115
117
, http-types >= 0.8 && < 1.0
116
118
, mtl >= 2.1 && < 3.0
117
119
, transformers-base >= 0.4 && < 1.0
118
120
, monad-control >= 0.3 && < 1.0
119
121
, lifted-base >= 0.2 && < 1.0
120
- , vector >= 0.10 && < 1.0
122
+ , vector >= 0.10 && < 1.0
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import qualified Data.ByteString as B
15
15
import Data.Conduit
16
16
import qualified Data.Conduit.List as CL
17
17
import qualified Network.Wai as Wai
18
+ import qualified Network.Wai.Conduit as Wai
18
19
19
20
--------------------------------------------------------------------------------
20
21
-- | Run!
@@ -31,7 +32,9 @@ sourceHTTPRequest request = do
31
32
case (method, path) of
32
33
(" GET" , (WithoutSession _ _)) -> yield Handshake
33
34
(" GET" , (WithSession _ _ _ sessionID)) -> yield (Connect sessionID)
34
- (" POST" , (WithSession _ _ _ sessionID)) -> Wai. requestBody request $= demultiplexMessage =$= awaitForever (yield . Request sessionID)
35
+ (" POST" , (WithSession _ _ _ sessionID)) -> do
36
+ let reqSource = Wai. sourceRequestBody request
37
+ reqSource $= demultiplexMessage =$= awaitForever (yield . Request sessionID)
35
38
(_, (WithSession _ _ _ sessionID)) -> yield (Disconnect sessionID)
36
39
_ -> error " error handling http request"
37
40
@@ -71,4 +74,4 @@ toFlushBuilder = do
71
74
Just b' -> do
72
75
yield $ Chunk (Builder. fromByteString b')
73
76
toFlushBuilder
74
- Nothing -> yield $ Flush
77
+ Nothing -> yield $ Flush
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import Data.Conduit
20
20
import Network.HTTP.Types (status200 )
21
21
import Network.HTTP.Types.Header (ResponseHeaders )
22
22
import qualified Network.Wai as Wai
23
+ import qualified Network.Wai.Conduit as Wai
23
24
import qualified Network.Wai.Handler.Warp as Warp
24
25
25
26
--------------------------------------------------------------------------------
@@ -50,14 +51,13 @@ serverConfig port config handler = do
50
51
--------------------------------------------------------------------------------
51
52
-- | Wrapped as a HTTP app
52
53
httpApp :: ResponseHeaders -> (Request -> IO Message ) -> Wai. Application
53
- httpApp headerFields runConnection' httpRequest = liftIO $ do
54
+ httpApp headerFields runConnection' httpRequest respond = do
54
55
55
56
let origin = lookupOrigin httpRequest
56
57
let headerFields' = insertOrigin headerFields origin
57
-
58
58
let sourceBody = sourceHTTPRequest httpRequest $= runRequest runConnection'
59
59
60
- return $ Wai. responseSource status200 headerFields' sourceBody
60
+ respond $ Wai. responseSource status200 headerFields' sourceBody
61
61
62
62
where lookupOrigin req = case lookup " Origin" (Wai. requestHeaders req) of
63
63
Just origin -> origin
@@ -102,4 +102,4 @@ defaultConfig = Configuration
102
102
, heartbeatTimeout = 60
103
103
, heartbeatInterval = 25
104
104
, pollingDuration = 20
105
- }
105
+ }
You can’t perform that action at this time.
0 commit comments