Git Product home page Git Product logo

c-mosquitto's People

Contributors

jesuspc avatar rickynils avatar tolysz avatar xkollar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

c-mosquitto's Issues

Username + Password authentication via TLS not possible

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

Issues with clean session (clearSession)

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.