Maintainer | koomi+mqtt@hackerspace-bamberg.de |
---|---|
Safe Haskell | None |
An MQTT client library.
- run :: Config -> IO Terminated
- data Terminated
- disconnect :: Config -> IO ()
- data Config
- defaultConfig :: Commands -> TChan (Message PUBLISH) -> Config
- data Commands
- mkCommands :: IO Commands
- cHost :: Config -> HostName
- cPort :: Config -> PortNumber
- cClean :: Config -> Bool
- cWill :: Config -> Maybe Will
- cUsername :: Config -> Maybe Text
- cPassword :: Config -> Maybe Text
- cKeepAlive :: Config -> Maybe Word16
- cClientID :: Config -> Text
- cLogDebug :: Config -> String -> IO ()
- cPublished :: Config -> TChan (Message PUBLISH)
- cCommands :: Config -> Commands
- cInputBufferSize :: Config -> Int
- subscribe :: Config -> [(Topic, QoS)] -> IO [QoS]
- unsubscribe :: Config -> [Topic] -> IO ()
- publish :: Config -> QoS -> Bool -> Topic -> ByteString -> IO ()
- module Network.MQTT.Types
Setup
run :: Config -> IO TerminatedSource
Connect to the configured broker, write received Publish
messages to the
cPublished
channel and handle commands from the cCommands
channel.
Exceptions are propagated.
data Terminated Source
Reasons for why the connection was terminated.
ParseFailed [String] String | at the context in |
ConnectFailed ConnectError | |
UserRequested |
|
disconnect :: Config -> IO ()Source
Close the connection after sending a Disconnect
message.
See also: Will
The various options when establishing a connection. See below for available accessors.
defaultConfig :: Commands -> TChan (Message PUBLISH) -> ConfigSource
Defaults for Config
, connects to a server running on
localhost.
mkCommands :: IO CommandsSource
Create a new Commands
channel.
There should be one channel per MQTT connection. It might be reused by subsequent connections, but never by multiple connections concurrently.
Config accessors
cClean :: Config -> BoolSource
Should the server forget subscriptions and other state on disconnects?
cKeepAlive :: Config -> Maybe Word16Source
cPublished :: Config -> TChan (Message PUBLISH)Source
The channel received Publish
messages are written to.
cInputBufferSize :: Config -> IntSource
Maximum number of bytes read from the network at once.
Subscribing and publishing
Reexports
module Network.MQTT.Types