tolysz / c-mosquitto Goto Github PK
View Code? Open in Web Editor NEWSimple Amazon IoT compatible client
License: BSD 3-Clause "New" or "Revised" License
Simple Amazon IoT compatible client
License: BSD 3-Clause "New" or "Revised" License
Hi Folks,
thanks for your efforts in building and maintaining this library.
I'd like to use TLS with username and password authentication against a broker. As I'm not using self signed certificates I'm not able to generate a client certificate that I could use.
libmosquitto supports this by setting keyfile
and certfile
to NULL
in mosquitto_tls_set
according to the documentation: https://mosquitto.org/api/files/mosquitto-h.html#mosquitto_tls_set
c-mosquitto however does not allow me to feed NULL
into
setTls :: Mosquitto a -> String -> String -> String -> IO ()
since Strings are not nullable in Haskell.
I could imagine the following solution:
Mosquitto.TlsConfig = ClientCertificateConfig String String String | CaOnlyConfig String
setTls :: Mosquitto a -> Mosquitto.TlsConfig -> IO ()
Unfortunately that would be a breaking API change. What's your opinion on that?
Best Regards
When connecting to a server without a clean session, the application does not seem to connect properly.
On the server side, I see:
1571925100: New connection from 192.168.48.135 on port 443.
1571925100: New client connected from 192.168.48.135 as session-f931762b-97c6-49b6-a18a-e2daaf62dc57 (c0, k100, u'stresstest').
1571925102: Client session-f931762b-97c6-49b6-a18a-e2daaf62dc57 disconnected.
--
1571925130: New connection from 192.168.48.135 on port 443.
1571925130: Client session-f931762b-97c6-49b6-a18a-e2daaf62dc57 disconnected.
1571925130: New client connected from 192.168.48.135 as session-f931762b-97c6-49b6-a18a-e2daaf62dc57 (c0, k100, u'stresstest').
As you can see, the server first logs a disconnect event, and then a connect event. But it also earlier logged a disconnect event for that same session ID.
The client will PINGREQ and PINGRESP properly, but not receive any messages. Possibly because the subscriptions aren't restored?
I can't really understand it. I've attached a test case scenario: Stresstest.hs.gz. I've compiled it by adding this to the cabal file:
executable stresstest
hs-source-dirs: app
main-is: Stresstest.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, bytestring
, c-mosquitto
, containers
, data-default-class
, options
, uuid
default-language: Haskell2010
This scenario creates a clean session, then spams a bunch of messages to this session from a different client, and then reconnects with the session.
https://github.com/dustin/mqtt-hs does not have the same problem, so the bug is probably not in the server: mqtt-hs-stresstest.gz
I'm running mosquitto 1.4.15, there is no mention in the changelog of any bug fixes related to clean session since that version. And I'm having a hard time imagining that this would be a bug in the C library. But I can't be sure.
Any suggestions on why this might be?
Basically, loop_forever can return an error (either a code or a string via strerror_r
). If it returns, you can't see why it did.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.