Secure WebSocket (WSS) clients
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
Secure WebSocket (WSS) clients in Haskell.
Wuss is a library that lets you easily create secure WebSocket clients over the
WSS protocol. It is a small addition to the
websockets package and is
adapted from existing solutions by @jaspervdj, @mpickering, and
To add Wuss as a dependency to your package, add it to your Cabal file.
For other use cases, install it with Cabal.
$ cabal install wuss
import Wuss import Control.Concurrent (forkIO) import Control.Monad (forever, unless, void) import Data.Text (Text, pack) import Network.WebSockets (ClientApp, receiveData, sendClose, sendTextData) main :: IO () main = runSecureClient "echo.websocket.org" 443 "/" ws ws :: ClientApp () ws connection = do putStrLn "Connected!" void . forkIO . forever $ do message <- receiveData connection print (message :: Text) let loop = do line <- getLine unless (null line) $ do sendTextData connection (pack line) loop loop sendClose connection (pack "Bye!")
For more information about Wuss, please read the Haddock documentation.