After testing and comparing with mosquitto (http://mosquitto.org) using mosquitto's python client the behavior is still different (and not very usable, sadly)
Connecting with keepalive=0 results in the _client_ disconnecting immediately from the server (either mosquitto or activemq). So setting keep alive to 0 in the client isn't the way to keep the connection open forever. Connecting with keepalive=x (x > 0) results in the client keeping the connection open sending ping's every x seconds. If no PINGRESP is received after x seconds, the _client_ closes the connection. The mosquitto server keeps the connection open as long as pings are exchanged. The activemq server closes the connection after x seconds despite pings being received, it only keeps the connection open if other messages than pings are received. Maybe the (short term) solution is to make pings reset the countdown of the inactivity monitor, just like normal messages reset the countdown. I'm not really familiar with the MQTT (or activemq for that matter) protocol, but to me the problem seems to lie in the fact that in the MQTT protocol there is no such thing as keepalive / inactivitymonitor. Connections are kept open forever despite inactivity (when inactivity is defined as no messages except pingreq/pingresp). There is no way to clean unused connections in the way inactivitymonitor tries to do. Only a raw disconnect or a failure to ping disconnects a connection. -- View this message in context: http://activemq.2283324.n4.nabble.com/MQTT-Impossible-to-disable-InactivityMonitor-tp4657945p4658026.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.