websockets 0.7.2.1 → 0.7.3.0
raw patch · 3 files changed
+32/−11 lines, 3 filesdep ~case-insensitive
Dependency ranges changed: case-insensitive
Files
- src/Network/WebSockets/Client.hs +27/−6
- src/Network/WebSockets/Protocol/Hybi00/Internal.hs +1/−1
- websockets.cabal +4/−4
src/Network/WebSockets/Client.hs view
@@ -4,6 +4,7 @@ module Network.WebSockets.Client ( connect , connectWith+ , connectWithSocket ) where @@ -49,18 +50,38 @@ -> WebSockets p a -- ^ Client application -> IO a connectWith host port path origin wsProtocols app = do- -- Create the request- request <- createRequest protocol bHost bPath bOrigin bWsProtocols False-- -- Connect to server+ -- Create and connect socket+ let hints = S.defaultHints+ {S.addrFamily = S.AF_INET, S.addrSocketType = S.Stream} sock <- S.socket S.AF_INET S.Stream S.defaultProtocol- addrInfos <- S.getAddrInfo Nothing (Just host) (Just $ show port)+ addrInfos <- S.getAddrInfo (Just hints) (Just host) (Just $ show port) S.connect sock (S.addrAddress $ head addrInfos)- res <- E.run_ $ SE.enumSocket 4096 sock $$ (iter request) $ iterSocket sock + -- Connect WebSocket and run client+ res <- connectWithSocket sock host path origin wsProtocols app+ -- Clean up S.sClose sock return res+++--------------------------------------------------------------------------------+connectWithSocket :: Protocol p+ => S.Socket -- ^ Socket+ -> String -- ^ Host+ -> String -- ^ Path+ -> Maybe String -- ^ Origin, if Nothing then server+ -- interprets connection as not coming+ -- from a browser.+ -> Maybe [String] -- ^ Protocol List+ -> WebSockets p a -- ^ Client application+ -> IO a+connectWithSocket sock host path origin wsProtocols app = do+ -- Create the request+ request <- createRequest protocol bHost bPath bOrigin bWsProtocols False++ -- Connect to server+ E.run_ $ SE.enumSocket 4096 sock $$ (iter request) $ iterSocket sock where protocol = head implementations iter request = runWebSocketsClient protocol request app
src/Network/WebSockets/Protocol/Hybi00/Internal.hs view
@@ -36,7 +36,7 @@ createRequest Hybi00_ = error "createRequest Hybi00_" finishRequest Hybi00_ = handshakeHybi00 finishResponse Hybi00_ = error "finishResponse Hybi00_"- implementations = [Hybi00_]+ implementations = [Hybi00_] instance TextProtocol Hybi00_
websockets.cabal view
@@ -1,5 +1,5 @@ Name: websockets-Version: 0.7.2.1+Version: 0.7.3.0 Synopsis: A sensible and clean way to write WebSocket-capable servers in Haskell.@@ -23,7 +23,7 @@ License: BSD3 License-file: LICENCE Copyright: (c) 2010-2011 Siniša Biđin- (c) 2011 Jasper Van der Jeugt+ (c) 2011-2013 Jasper Van der Jeugt (c) 2011 Steffen Schuldenzucker (c) 2011 Alex Lang Author: Siniša Biđin <sinisa@bidin.cc>@@ -73,7 +73,7 @@ blaze-builder >= 0.3 && < 0.4, blaze-builder-enumerator >= 0.2 && < 0.3, bytestring >= 0.9 && < 0.11,- case-insensitive >= 0.3 && < 2.0,+ case-insensitive >= 0.3 && < 1.1, containers >= 0.3 && < 0.6, enumerator >= 0.4.13 && < 0.5, mtl >= 2.0 && < 2.2,@@ -106,7 +106,7 @@ blaze-builder >= 0.3 && < 0.4, blaze-builder-enumerator >= 0.2 && < 0.3, bytestring >= 0.9 && < 0.11,- case-insensitive >= 0.3 && < 0.5,+ case-insensitive >= 0.3 && < 1.1, containers >= 0.3 && < 0.6, enumerator >= 0.4.13 && < 0.5, mtl >= 2.0 && < 2.2,