-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | WebSockets support for Yesod
--   
--   API docs and the README are available at
--   <a>http://www.stackage.org/package/yesod-websockets</a>
@package yesod-websockets
@version 0.2.6

module Yesod.WebSockets

-- | A transformer for a WebSockets handler.
--   
--   Since 0.1.0
type WebSocketsT = ReaderT Connection

-- | Attempt to run a WebSockets handler. This function first checks if the
--   client initiated a WebSockets connection and, if so, runs the provided
--   application, short-circuiting the rest of your handler. If the client
--   did not request a WebSockets connection, the rest of your handler will
--   be called instead.
--   
--   Since 0.1.0
webSockets :: (MonadBaseControl IO m, MonadHandler m) => WebSocketsT m () -> m ()

-- | Varient of <a>webSockets</a> which allows you to specify the
--   <a>AcceptRequest</a> setttings when upgrading to a websocket
--   connection.
--   
--   Since 0.2.4
webSocketsWith :: (MonadBaseControl IO m, MonadHandler m) => (RequestHead -> m (Maybe AcceptRequest)) -> WebSocketsT m () -> m ()

-- | Varient of <a>webSockets</a> which allows you to specify the
--   WS.ConnectionOptions setttings when upgrading to a websocket
--   connection.
--   
--   Since 0.2.5
webSocketsOptions :: (MonadBaseControl IO m, MonadHandler m) => ConnectionOptions -> WebSocketsT m () -> m ()

-- | Varient of <a>webSockets</a> which allows you to specify both the
--   WS.ConnectionOptions and the <a>AcceptRequest</a> setttings when
--   upgrading to a websocket connection.
--   
--   Since 0.2.5
webSocketsOptionsWith :: (MonadBaseControl IO m, MonadHandler m) => ConnectionOptions -> (RequestHead -> m (Maybe AcceptRequest)) -> WebSocketsT m () -> m ()

-- | Receive a piece of data from the client.
--   
--   Since 0.1.0
receiveData :: (MonadIO m, WebSocketsData a) => WebSocketsT m a

-- | Receive a piece of data from the client. Capture SomeException as the
--   result or operation Since 0.2.2
receiveDataE :: (MonadIO m, WebSocketsData a) => WebSocketsT m (Either SomeException a)

-- | Receive an application message. Capture SomeException as the result or
--   operation Since 0.2.3
receiveDataMessageE :: (MonadIO m) => WebSocketsT m (Either SomeException DataMessage)

-- | Send a ping message to the client.
--   
--   Since 0.2.2
sendPing :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m ()

-- | Send a ping message to the client. Capture SomeException as the result
--   of operation Since 0.2.2
sendPingE :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m (Either SomeException ())

-- | Send a close request to the client.
--   
--   Since 0.2.2
sendClose :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m ()

-- | Send a close request to the client. Capture SomeException as the
--   result of operation Since 0.2.2
sendCloseE :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m (Either SomeException ())

-- | Send a textual message to the client.
--   
--   Since 0.1.0
sendTextData :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m ()

-- | Send a textual message to the client. Capture SomeException as the
--   result or operation and can be used like `either handle_exception
--   return =&lt;&lt; sendTextDataE (<a>Welcome</a> :: Text)` Since 0.2.2
sendTextDataE :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m (Either SomeException ())

-- | Send a binary message to the client.
--   
--   Since 0.1.0
sendBinaryData :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m ()

-- | Send a binary message to the client. Capture SomeException as the
--   result of operation Since 0.2.2
sendBinaryDataE :: (MonadIO m, WebSocketsData a) => a -> WebSocketsT m (Either SomeException ())

-- | Send a DataMessage to the client. Capture SomeException as the result
--   of operation Since 0.2.3
sendDataMessageE :: (MonadIO m) => DataMessage -> WebSocketsT m (Either SomeException ())

-- | A <tt>Source</tt> of WebSockets data from the user.
--   
--   Since 0.1.0
sourceWS :: (MonadIO m, WebSocketsData a) => Producer (WebSocketsT m) a

-- | A <tt>Sink</tt> for sending textual data to the user.
--   
--   Since 0.1.0
sinkWSText :: (MonadIO m, WebSocketsData a) => Consumer a (WebSocketsT m) ()

-- | A <tt>Sink</tt> for sending binary data to the user.
--   
--   Since 0.1.0
sinkWSBinary :: (MonadIO m, WebSocketsData a) => Consumer a (WebSocketsT m) ()

-- | Generalized version of <a>race</a>.
--   
--   Since 0.1.0
race :: MonadBaseControl IO m => m a -> m b -> m (Either a b)

-- | Generalized version of <a>race_</a>.
--   
--   Since 0.1.0
race_ :: MonadBaseControl IO m => m a -> m b -> m ()

-- | Generalized version of <a>concurrently</a>. Note that if your
--   underlying monad has some kind of mutable state, the state from the
--   second action will overwrite the state from the first.
--   
--   Since 0.1.0
concurrently :: MonadBaseControl IO m => m a -> m b -> m (a, b)

-- | Run two actions concurrently (like <a>concurrently</a>), but discard
--   their results and any modified monadic state.
--   
--   Since 0.1.0
concurrently_ :: MonadBaseControl IO m => m a -> m b -> m ()
defaultConnectionOptions :: ConnectionOptions

-- | Set options for a <a>Connection</a>.
data ConnectionOptions :: *
ConnectionOptions :: ~(IO ()) -> ConnectionOptions

-- | Whenever a <tt>pong</tt> is received, this IO action is executed. It
--   can be used to tickle connections or fire missiles.
[connectionOnPong] :: ConnectionOptions -> ~(IO ())
