Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] API questions

Hi,
 
I just started using Mosquitto (and MQTT).  I've built libmosquitto (statically) into a server running on win, linux, solaris (sparc and intel) in all 32-bit and 64-bit flavors and have been pretty pleased.  I hope you don't mind a barrage of unresolved questions:
 
1.  I have one publisher with many subscribers.  The publisher is a server (runs for long periods of time) and mosquitto runs locally on the same box.  Is there any downside to keeping the connection open to mosquitto while my server is up (i.e. connect once at startup, disconnect on shutdown)?  I want to avoid connecting/disconnecting for each message I need to publish.
 
I've been logging the disconnects and reconnecting and I've noticed I see random disconnects during the night (when my local server is inactive).   Most are MOSQ_ERR_CONN_LOST and then they immediately reconnect.  But occasionally after calling reconnect, I'll get a second disconnect callback with result code 1 (MOSQ_ERR_NOMEM?) followed by a successful connection callback.
 
This has made me question the merits of keeping the connection open.  Is there a recommended best practice?
 
 
2.  I'm using the async connect/reconnect and the threaded interface.  I start the loop before the connection and stop it after the disconnect.  I expected the publishes (qos 2) to send immediately, but they seem to get stuck and don't go out until the PING from the client.  If I call mosquitto_loop(mosq, -1, 1) right after the publish they go out immediately.  I don't understand the reason for this, I would have expected the threaded interface to publish the message.
 
This is very similar to the example mosquitto_pub application with -l option (MSGMODE_STDIN_LINE), although my publishes all occur on different worker threads. 
 
 
3.  I monitor the queue by running the mosquitto_sub application.  I occasionally (but not every time) get "Warning: Unable to open socket pair, outgoing publish commands may be delayed."   What is the cause of this and what does this mean/imply?
 
 
4.  Finally, our server product still runs on XP.  In time_mosq.c, I see the _WIN32_WINNT_VISTA and see that you check the version of windows in _windows_time_version_check, but that doesn't appear to be called (so tick64 is always false).  Regardless, having the GetTickCount64 import (even if not called) causes the loader to choke on XP.  I changed it to find the address at run time (GetProcAddress in kernel32), which works well, but wanted to ask about the intention of this code since it is not called and even on later windows versions tick64 is still false.
 
 
Thanks!

Back to the top