net-mqtt: An MQTT Protocol Implementation.

[ bsd3, library, network, program ] [ Propose Tags ] [ Report a vulnerability ]

Please see the README on GitHub at https://github.com/dustin/mqtt-hs#readme


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.2.3.0, 0.2.3.1, 0.2.4.0, 0.2.4.1, 0.2.4.2, 0.5.0.0, 0.5.0.1, 0.5.0.2, 0.5.1.0, 0.6.0.0, 0.6.0.1, 0.6.0.2, 0.6.1.0, 0.6.1.1, 0.6.2.0, 0.6.2.1, 0.6.2.2, 0.6.2.3, 0.7.0.0, 0.7.0.1, 0.7.1.0, 0.7.1.1, 0.8.0.0, 0.8.0.1, 0.8.0.2, 0.8.1.0, 0.8.2.0, 0.8.2.1, 0.8.2.2, 0.8.2.3, 0.8.2.4, 0.8.2.5, 0.8.3.0, 0.8.5.0, 0.8.6.0, 0.8.6.1
Change log Changelog.md
Dependencies async (>=2.2.1 && <2.3), attoparsec (>=0.13.2 && <0.15), attoparsec-binary (>=0.2 && <1.0), base (>=4.7 && <5), binary (>=0.8.5 && <0.9), bytestring (>=0.10.8 && <0.12), conduit (>=1.3.1 && <1.5), conduit-extra (>=1.3.0 && <1.5), containers (>=0.5.0 && <0.7), crypton-connection (>=0.3.0), data-default-class (>=0.1.2), deepseq (>=1.4.3.0 && <1.5), monad-loops (>=0.4.3), net-mqtt, network-conduit-tls (>=1.4 && <1.5), network-uri (>=2.6.1 && <2.7), optparse-applicative, QuickCheck (>=2.12.6.1 && <2.15), stm (>=2.4.0 && <2.6), text (>=1.2.3 && <2.1.0), time (>=1.9), websockets (>=0.12.5.3 && <0.13) [details]
License BSD-3-Clause
Copyright BSD3
Author Dustin Sallings
Maintainer dustin@spy.net
Category Network
Home page https://github.com/dustin/mqtt-hs#readme
Bug tracker https://github.com/dustin/mqtt-hs/issues
Source repo head: git clone https://github.com/dustin/mqtt-hs
Uploaded by dustin at 2024-07-26T18:23:29Z
Distributions NixOS:0.8.6.1
Reverse Dependencies 3 direct, 0 indirect [details]
Executables mqtt-watch, mqtt-example
Downloads 14048 total (102 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-07-26 [all 1 reports]

Readme for net-mqtt-0.8.6.1

[back to package description]

mqtt

An MQTT protocol implementation for Haskell.

Client Examples

Publish

import Network.MQTT.Client
import Network.URI (parseURI)

main :: IO ()
main = do
  let (Just uri) = parseURI "mqtt://test.mosquitto.org"
  mc <- connectURI mqttConfig uri
  publish mc "tmp/topic" "hello!" False

Subscribe

import Network.MQTT.Client
import Network.URI (parseURI)

main :: IO ()
main = do
  let (Just uri) = parseURI "mqtt://test.mosquitto.org"
  mc <- connectURI mqttConfig{_msgCB=SimpleCallback msgReceived} uri
  print =<< subscribe mc [("tmp/topic1", subOptions), ("tmp/topic2", subOptions)] []
  waitForClient mc   -- wait for the the client to disconnect

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