wuss: Secure WebSocket (WSS) clients

[ library, mit, network ] [ Propose Tags ]

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.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
pedanticDisabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0, 1.0.1, 1.0.2, 1.0.4, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.1.9, 1.1.10, 1.1.11, 1.1.12, 1.1.13, 1.1.14, 1.1.15, 1.1.16, 1.1.17, 1.1.18, 1.1.19, 2.0.0.0, 2.0.0.1, 2.0.0.2, 2.0.1.0, 2.0.1.1, 2.0.1.2, 2.0.1.3, 2.0.1.4, 2.0.1.5, 2.0.1.6, 2.0.1.7, 2.0.1.8, 2.0.1.9, 2.0.2.0
Change log CHANGELOG.md
Dependencies base (>=4.18.0.0 && <4.19 || >=4.19.0.0 && <4.20 || >=4.20.0.0 && <4.21), bytestring (>=0.11.4.0 && <0.12 || >=0.12.0.2 && <0.13), crypton-connection (>=0.3.2 && <0.4 || >=0.4.0 && <0.5), data-default (>=0.7.1.1 && <0.8), exceptions (>=0.10.7 && <0.11), network (>=3.1.4.0 && <3.2 || >=3.2.0.0 && <3.3), websockets (>=0.12.7.3 && <0.13 || >=0.13.0.0 && <0.14) [details]
License MIT
Author
Maintainer Taylor Fausak
Category Network
Source repo head: git clone https://github.com/tfausak/wuss
Uploaded by fozworth at 2024-07-31T15:45:29Z
Distributions Arch:2.0.1.1, LTSHaskell:2.0.2.0, NixOS:2.0.1.9, Stackage:2.0.2.0
Reverse Dependencies 27 direct, 12 indirect [details]
Downloads 17317 total (176 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-07-31 [all 1 reports]

Readme for wuss-2.0.2.0

[back to package description]

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.