Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-13 Thread Bart Van Der Meerssche
Hello Roger, Thanks for replying. I would expect the bindings to be functionally equivalent to what the C loop is doing. This is not the case since: 1/ the socket is not properly closed through _mosquitto_socket_close 2/ _mosquitto_socket_close cleans up mosq->ssl, mosq->ssl_ctx and mosq->sock

Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-13 Thread Bart Van Der Meerssche
Hello Andy, Please find my comments inline. Since our discussion is a bit off-topic for the mosquitto mailing list, I'd like to focus on the original question: Looking at the mosquitto_loop code shows that if a read or write error occurs, the socket is closed with the private _mosquitto_socke

Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-13 Thread Roger Light
Hi Bart, Would the lua equivalent of this do what you want? rc = mosquitto_loop_read(mosq); if(rc == MOSQ_ERR_CONN_LOST){ /* We've been disconnected from the server */ mosquitto_reconnect(mosq); do_something_with_socket(mosquitto_socket(mosq)); } Apologies for the brief reply, I'm ju

Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-13 Thread Andy Gelme
hi Bart, On 2012-12-13 10:06 , Bart Van Der Meerssche wrote: > Hi Andy^2 I suspect that I'm at least Andy^3 (or later) in the time-line of MQTT. > My use case includes listening on multiple sockets/pipes/devs > simultaneously, processing and then passing on the message. mqtt_lua > is not evented

Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-12 Thread Bart Van Der Meerssche
Hi Andy^2, My use case includes listening on multiple sockets/pipes/devs simultaneously, processing and then passing on the message. mqtt_lua is not evented AFAIK. You need to call mqtt_client:handler() every second or so, much like mosquitto_loop. I like the fact that libmosquitto allows lo

Re: [Mosquitto-users] using libmosquitto in an external event loop

2012-12-12 Thread andypipe...@gmail.com
You know that the Eclipse Paho project has a Lua client due to hit Git within days, right? On Wednesday, December 12, 2012, Bart Van Der Meerssche wrote: > Hello list, > > I'm currently writing Lua bindings for libmosquitto [1]. Since Lua does > not support preemptive multithreading, using mosqui