ghcjs-websockets: Deprecated: use ghcjs-base's native websockets
Deprecated in favor of ghcjs-base's native websockets.
'ghcjs-websockets' aims to provide a clean, idiomatic,
efficient, low-level, out-of-your-way, bare bones,
concurrency-aware interface with minimal abstractions
inspired by common Haskell idioms found in libraries like
http://hackage.haskell.org/package/io-streams and the
The interface asbtracts websockets as simple IO/file
handles, with additional access to the natively "typed"
There are also convenience functions to directly decode
serialized data (serialized with
http://hackage.haskell.org/package/binary) sent through
The library is mostly intended to be a low-level FFI library, with the hopes that other, more advanced libraries maybe build on the low-level FFI bindings in order to provide more advanced and powerful abstractions. Most design decisions were made with the intent of keeping things as simple as possible in order for future libraries to abstract over it.
Most of the necessary functionality is in hopefully in
it for library construction.
instructions and examples.
import Data.Text (unpack) -- A simple echo client, echoing all incoming text data main :: IO () main = withUrl "ws://my-server.com" $ \conn -> forever $ do t <- receiveText conn putStrLn (unpack t) sendText conn t
-- A simple client waiting for connections and outputting the running sum main :: IO () main = withUrl "ws://my-server.com" (runningSum 0) runningSum :: Int -> Connection -> IO () runningSum n conn = do i <- receiveData conn print (n + i) runningSum (n + i) conn
-- Act as a relay between two servers main :: IO () main = do conn1 <- openConnection "ws://server-1.com" conn2 <- openConnection "ws://server-2.com" forever $ do msg <- receiveMessage conn1 sendMessage conn2 msg closeConnection conn2 closeConnection conn1
[Skip to Readme]
Tell cabal we are using ghcjs (work around until hackage supports impl(ghcjs))
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
- ghcjs-websockets-0.3.0.5.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
|Versions [RSS]||0.3.0.0, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.0.4, 0.3.0.5 (info)|
|Dependencies||base (>=4.7 && <5), base64-bytestring (>=1), binary (>=0.7), bytestring (>=0.10), ghcjs-base (>=0.1), text (>=1) [details]|
|Copyright||Copyright (c) Justin Le 2015|
|Author||Justin Le <email@example.com>|
|Maintainer||Justin Le <firstname.lastname@example.org>|
|Revised||Revision 1 made by jle at 2016-10-23T09:28:13Z|
|Source repo||head: git clone https://github.com/mstksg/ghcjs-websockets|
|Uploaded||by jle at 2015-08-08T07:25:11Z|
|Downloads||3321 total (27 in the last 30 days)|
|Rating||(no votes yet) [estimated by Bayesian average]|
|Status||Docs available [build log]
Last success reported on 2015-08-08 [all 1 reports]