Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides logic code for interacting with the Discord websocket gateway. Realistically, this is probably lower level than most people will need
Synopsis
- data GatewayException
- data ConnLoopState
- connect :: (Connection -> IO a) -> IO a
- type DiscordHandleGateway = (Chan (Either GatewayException Event), Chan GatewaySendable)
- connectionLoop :: Auth -> DiscordHandleGateway -> Chan Text -> IO ()
- getPayloadTimeout :: Connection -> Int -> Chan Text -> IO (Either ConnectionException GatewayReceivable)
- getPayload :: Connection -> Chan Text -> IO (Either ConnectionException GatewayReceivable)
- heartbeat :: Chan GatewaySendable -> Int -> IORef Integer -> IO ()
- setSequence :: IORef Integer -> Integer -> IO ()
- data ConnectionData = ConnData {}
- startEventStream :: ConnectionData -> Int -> Integer -> Chan GatewaySendable -> Chan Text -> IO ConnLoopState
- eventStream :: ConnectionData -> IORef Integer -> Int -> Chan GatewaySendable -> Chan Text -> IO ConnLoopState
- data Sendables = Sendables {}
- sendableLoop :: Connection -> Sendables -> IO ()
Documentation
data GatewayException Source #
GatewayExceptionCouldNotConnect Text | |
GatewayExceptionEventParseError Text Text | |
GatewayExceptionUnexpected GatewayReceivable Text | |
GatewayExceptionConnection ConnectionException Text |
Instances
Show GatewayException Source # | |
Defined in Discord.Internal.Gateway.EventLoop showsPrec :: Int -> GatewayException -> ShowS # show :: GatewayException -> String # showList :: [GatewayException] -> ShowS # |
data ConnLoopState Source #
Instances
Show ConnLoopState Source # | |
Defined in Discord.Internal.Gateway.EventLoop showsPrec :: Int -> ConnLoopState -> ShowS # show :: ConnLoopState -> String # showList :: [ConnLoopState] -> ShowS # |
connect :: (Connection -> IO a) -> IO a Source #
Securely run a connection IO action. Send a close on exception
type DiscordHandleGateway = (Chan (Either GatewayException Event), Chan GatewaySendable) Source #
connectionLoop :: Auth -> DiscordHandleGateway -> Chan Text -> IO () Source #
getPayloadTimeout :: Connection -> Int -> Chan Text -> IO (Either ConnectionException GatewayReceivable) Source #
getPayload :: Connection -> Chan Text -> IO (Either ConnectionException GatewayReceivable) Source #
data ConnectionData Source #
What we need to start an event stream
ConnData | |
|
startEventStream :: ConnectionData -> Int -> Integer -> Chan GatewaySendable -> Chan Text -> IO ConnLoopState Source #
eventStream :: ConnectionData -> IORef Integer -> Int -> Chan GatewaySendable -> Chan Text -> IO ConnLoopState Source #
Sendables | |
|
sendableLoop :: Connection -> Sendables -> IO () Source #