-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Simple interface to WebSockets.
--
-- Simple interface to WebSockets.
@package network-simple-ws
@version 0.1
-- | Simple tools for establishing and using insecure WebSockets
-- connections on top of TCP (i.e, ws://).
--
-- See the network-simple-wss package for Secure WebSockets (i.e,
-- wss://) support.
--
-- Notice that, currently, this is package offers tools that are mostly
-- intreresting from a client's point of view. Server side support will
-- come later.
module Network.Simple.WS
data Connection
-- | Send bytes to the remote end.
--
-- Takes a lazy ByteString.
send :: MonadIO m => Connection -> ByteString -> m ()
-- | Receive bytes from the remote end.
--
-- Returns a strict ByteString.
--
-- Returns an empty string when the remote end gracefully closes the
-- connection.
recv :: MonadIO m => Connection -> m ByteString
-- | Connect to the specified WebSockets server.
connect :: (MonadIO m, MonadMask m) => HostName -> ServiceName -> ByteString -> [(ByteString, ByteString)] -> ((Connection, SockAddr) -> m r) -> m r
-- | Like connect, but connects to the destination server through a
-- SOCKS5 proxy.
connectSOCKS5 :: (MonadIO m, MonadMask m) => HostName -> ServiceName -> HostName -> ServiceName -> ByteString -> [(ByteString, ByteString)] -> ((Connection, SockAddr, SockAddr) -> m r) -> m r
-- | Obtain a Connection to the specified Uri over the
-- given Stream, connected to either a WebSockets server, or a
-- Secure WebSockets server.
clientConnectionFromStream :: MonadIO m => Stream -> HostName -> ServiceName -> ByteString -> [(ByteString, ByteString)] -> m Connection
-- | Obtain a Stream implemented using the network Socket.
-- You can use the network-simple library to get one of those.
streamFromSocket :: MonadIO m => Socket -> m Stream