wuss
2.0.2.1
Secure WebSocket (WSS) -Clients in Haskell.
WUSS ist eine Bibliothek, in der Sie auf dem WSS -Protokoll problemlos sichere WebSocket -Clients erstellen können. Es ist eine kleine Ergänzung zum websockets
-Paket und wird von @jaspervdj, @mpickering und @FenLaid aus vorhandenen Lösungen angepasst.
Um Ihr Paket als Abhängigkeit hinzuzufügen, fügen Sie es Ihrer Cabal -Datei hinzu.
build-depends: wuss
Installieren Sie es für andere Anwendungsfälle mit 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! " )
Weitere Informationen zu WUSS finden Sie in der Haddock -Dokumentation.