Hi Todd,

If you're calling out to ncat/socat, then it won't be a "pure" PicoLisp client.

In that case, why not simply call out to an existing C client or library such as Mosquitto: https://mosquitto.org/ ?

I've been doing that since ~2016 by calling the mosquitto_pub client from PicoLisp with a specific set of arguments (some fixed, some variable). It got me up and running with MQTT+PicoLisp much faster than writing an entire client from scratch.

Writing a native PicoLisp client that uses the mosquitto library might be even better than both our approaches though.

Just a thought.

Cheers,


AW

 On Sat, 9 Sep 2023, Todd Coram wrote:

Hi,
I've been porting my "pure" Common Lisp MQTT client to Picolisp, and it has gone very 
well for non-SSL connections (I just used "connect"), but I am looking for a canonical 
way to connect to a SSL/TLS encrypted socket (no certs needed, I just need basic encryption).

I've been using pipe and an external "helper" (ncat in this case but socat 
would be similar):

(de mq-open (Host Port SSL)
   (if SSL
        (pipe
         (exec "ncat" "--ssl" Host Port))
     (connect Host Port)))

Is this a good approach?  Using the FFI to call openssl library is more 
efficient, but I didn't want to go that path yet...
Once concern I have with the above code is dealing with when a connection is 
dropped.

My MQTT implementation currently has no "outside" dependencies (with the above 
exception) and I'd like to keep it as independent as possible.

Am I missing an obviously better approach?

/todd

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to