c-mosquitto: Simpe mosquito MQTT binding able to work with the Amazons IoT

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

Simpe mosquito MQTT binding able to work with the Amazons IoT but it should work with other providers


[Skip to Readme]

Modules

  • Language
    • C
      • Inline
        • Language.C.Inline.TypeLevel
  • Network
    • Network.Mosquitto
      • Internal
        • Network.Mosquitto.Internal.Inline
        • Network.Mosquitto.Internal.Types

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.1.2.0, 0.1.3.0, 0.1.4.0, 0.1.4.1, 0.1.5.0, 0.1.6.0, 0.1.7.0
Dependencies base (>=4.7 && <5), bytestring, c-mosquitto, containers, inline-c, options, primitive [details]
License BSD-3-Clause
Copyright 2017-9(c) Marcin Tolysz
Author Marcin Tolysz
Maintainer tolysz@gmail.com
Category Library
Home page https://github.com/tolysz/c-mosquitto#readme
Source repo head: git clone https://github.com/tolysz/c-mosquitto
Uploaded by tolysz at 2019-10-24T10:55:59Z
Distributions
Executables c-mosquitto
Downloads 6121 total (34 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2019-10-24 [all 3 reports]

Readme for c-mosquitto-0.1.7.0

[back to package description]

c-mosquitto

Full code

main :: IO ()
main = runCommand $ \MainOptions{..} args -> M.withMosquittoLibrary $ do
  print M.version

  m <- M.newMosquitto True "server" (Just ())
  M.setTls m caCert userCert userKey
  M.setTlsInsecure m True

  -- callbacks
  M.onMessage m print
  M.onLog m $ const putStrLn
  M.onConnect m print
  M.onDisconnect m print
  M.onSubscribe m $ curry print

  M.connect m server port keepAlive

  M.subscribe m 0 "rcv/#"

  forkIO $ forever $ do
    M.publish m False 0 "hello" "bla"
    threadDelay 5000000

  M.loopForever m
  M.destroyMosquitto m
  print "The end"

Hacking

Documentation for used C library can be found at https://mosquitto.org/api/files/mosquitto-h.html.