Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
5.13.4, 5.14.0
-
None
-
None
Description
I wrote a simple test to study how works LWT over websocket and ActiveMQ.
My code is pretty simple ...
var i_am_connected = new Paho.MQTT.Message(JSON.stringify({ version: 1, state: 2, timestamp: (lastConnection / 1000) })); i_am_connected.destinationName = "device/" + client_id + "/ping"; i_am_connected.retained = true; i_am_connected.qos = 1; var i_am_disconnected = new Paho.MQTT.Message(JSON.stringify({ version: 1, state: 0 })); i_am_disconnected.destinationName = "device/" + client_id + "/ping"; i_am_disconnected.retained = true; i_am_disconnected.qos = 1; client.connect({ timeout: 3, useSSL: false, cleanSession: true, willMessage: i_am_disconnected, onSuccess: function() { status.innerHTML = ""; client.send(i_am_connected); client.subscribe('device/+/ping'); } });
at connection, i publish a message...
with a LWT with an another state .. i could know if a device is connected or not.
so i close abruptly my browser to simulate a "lost connection".
i tested my sample over mosquitto and everything goes right..
i receive my LWT before the 150% of timeout..
but with ActiveMQ i suppose that closing my browser is like a clean disconnection.
2016-07-20 16:12:01,166 | DEBUG | MQTT Client 1469046760799 requests heart beat of 60000 ms | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-18 2016-07-20 16:12:01,166 | DEBUG | MQTT Client 1469046760799 established heart beat of 60000 ms (60000 ms + 30000 ms grace period) | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-18 2016-07-20 16:12:01,167 | DEBUG | Setting up new connection id: ID:deverylight-49125-1469029944589-3:7, address: ws://192.168.33.1:56928, info: ConnectionInfo {commandId = 0, responseRequired = true, connectionId = ID:deverylight-49125-1469029944589-3:7, clientId = 1469046760799, clientIp = null, userName = null, password = *****, brokerPath = null, brokerMasterConnector = false, manageable = false, clientMaster = true, faultTolerant = false, failoverReconnect = false} | org.apache.activemq.broker.TransportConnection | qtp1992642569-18 2016-07-20 16:12:01,169 | DEBUG | MQTT Client 1469046760799 connected. (version: 4) | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-18 2016-07-20 16:12:01,173 | DEBUG | deverylight adding destination: topic://device.1469046760799.ping | org.apache.activemq.broker.region.AbstractRegion | qtp1992642569-19 2016-07-20 16:13:03,844 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-20 2016-07-20 16:13:03,844 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-20 2016-07-20 16:13:03,844 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-20 2016-07-20 16:13:03,844 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-20 2016-07-20 16:14:03,847 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-15 2016-07-20 16:14:03,847 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-15 2016-07-20 16:14:03,847 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-15 2016-07-20 16:14:03,847 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-15 2016-07-20 16:15:03,851 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-16 2016-07-20 16:15:03,852 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-16 2016-07-20 16:15:03,852 | DEBUG | Received a ping from client: 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-16 2016-07-20 16:15:03,852 | DEBUG | Sent Ping Response to 1469046760799 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-16 2016-07-20 16:15:20,100 | DEBUG | MQTT Client 1469046760799 disconnecting | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | qtp1992642569-17