@hackage net-mqtt0.2.2.0

An MQTT Protocol Implementation.

mqtt

An MQTT protocol implementation for Haskell.

Client Examples

Publish

main :: IO
main = do
  mc <- runClient mqttConfig{}
  publish mc "tmp/topic" "hello!" False

Subscribe

main :: IO
main = do
  mc <- runClient mqttConfig{_msgCB=Just msgReceived}
  print =<< subscribe mc [("tmp/topic1", QoS0), ("tmp/topic2", QoS0)]
  print =<< waitForClient mc   -- wait for the the client to disconnect

  where
    msgReceived _ t m = print (t,m)