Giter Club home page Giter Club logo

Comments (6)

dustin avatar dustin commented on July 29, 2024 1

I added _tlsSettings :: TLSSettings to the MQTTConfig type and plumbed that through for both mqtts:// and wss:// connections. It's TLSSettings so you should be able to either a simple or full set of settings to configure the TLS bits of your client.

Let me know how this works!

from mqtt-hs.

AleXoundOS avatar AleXoundOS commented on July 29, 2024 1

For those, inexperienced like me, you need to populate ClientHooks with appropriate onCertificateRequest and onServerCertificate functions like here: https://stackoverflow.com/a/40082394/1663197.

from mqtt-hs.

dustin avatar dustin commented on July 29, 2024

Hmm... I was wondering how this might work, but haven't needed it myself. It's definitely something I need to consider.

I may need to abstract TLS settings in such a way I can supply TLS settings for both mqtts and wss since doing it from the URI is kind of hard.

In the meantime, I did expose the lower-level conduit mechanism. mqtts translates approximately torunClientTLS which is implemented like this:

-- | Set up and run a client connected via TLS.
runClientTLS :: MQTTConfig -> IO MQTTClient
runClientTLS cfg@MQTTConfig{..} = tcpCompat (runTLSClient (tlsClientConfig _port (BCS.pack _hostname))) cfg

-- Compatibility mechanisms for TCP Conduit bits.
tcpCompat :: ((AppData -> IO ()) -> IO ()) -> MQTTConfig -> IO MQTTClient
tcpCompat mkconn = runMQTTConduit (adapt mkconn)
  where adapt mk f = mk (f . adaptor)
        adaptor ad = (appSource ad, appSink ad)

from mqtt-hs.

dustin avatar dustin commented on July 29, 2024

I filed snoyberg/conduit/issues/423 for this. I don't see how I'd actually supply this to the underlying conduit TLS connector.

from mqtt-hs.

jbwdevries avatar jbwdevries commented on July 29, 2024

I figured you could use the TLSClientConfig constructor instead of the tlsClientConfig helper method

from mqtt-hs.

jbwdevries avatar jbwdevries commented on July 29, 2024

Can confirm this works as expected. Thanks!

from mqtt-hs.

Related Issues (19)

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.