MIT licensed and maintained by Taylor Fausak
This version can be pinned in stack with:wuss-1.0.2@sha256:339408fe54969fc744123752c5338cd5e665387ef23ce35acc0be05e9060b642,1458

Module documentation for 1.0.2

Wuss

Secure WebSocket (WSS) clients in Haskell.

Version Build Dependencies


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 ==1.0.*

For other use cases, install it with Cabal.

$ cabal install 'wuss ==1.0.*'

Wuss uses Semantic Versioning. See the change log for a detailed list of changes.

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 uses Semantic Versioning.

v1.0.2 (2015-06-04)

  • Added an example without certificate validation.

v1.0.1 (2015-06-04)

  • Improved documentation.
  • Supported doctest 0.10.

v1.0.0 (2015-04-15)

  • Initially released.

v0.0.0 (2015-04-15)

  • Initially created.