MIT licensed
Maintained by Taylor Fausak
This version can be pinned in stack with:wuss-2.0.2.0@sha256:2ed403d38549dcb47e1ca8d7b0693ab1a27d6f24d6a8af3ec41dbe945483dbd1,1540

Module documentation for 2.0.2.0

Wuss

CI Hackage

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 @elfenlaid.

Installation

To add Wuss as a dependency to your package, add it to your Cabal file.

build-depends: wuss

For other use cases, install it with Cabal.

$ cabal install wuss

Usage

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.

Changes

Change log

Wuss follows the Package Versioning Policy. You can find release notes on GitHub.