[ https://issues.apache.org/jira/browse/AMQ-6343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15361020#comment-15361020 ]
Sylvain Maucourt edited comment on AMQ-6343 at 7/4/16 8:40 AM: --------------------------------------------------------------- @Override public void onWebSocketClose(int statusCode, String reason) { LOG.debug("onWebSocketClose() - statusCode: {}, reason: {}", statusCode, reason); try { if (statusCode == StatusCode.NO_CLOSE) { getProtocolConverter().onTransportError(); } else { getProtocolConverter().onMQTTCommand(new DISCONNECT().encode()); } } catch (Exception e) { LOG.debug("Failed to close MQTT WebSocket cleanly", e); } } may fixes the issue? was (Author: sylvain): @Override public void onWebSocketClose(int statusCode, String reason) { LOG.debug("onWebSocketClose() - statusCode: {}, reason: {}", statusCode, reason); try { if (statusCode == StatusCode.NO_CLOSE) { getProtocolConverter().onTransportError(); } else { getProtocolConverter().onMQTTCommand(new DISCONNECT().encode()); } } catch (Exception e) { LOG.debug("Failed to close MQTT WebSocket cleanly", e); } } > [MQTT] LWT doesn't work over a websocket connection > --------------------------------------------------- > > Key: AMQ-6343 > URL: https://issues.apache.org/jira/browse/AMQ-6343 > Project: ActiveMQ > Issue Type: Bug > Affects Versions: 5.13.3 > Environment: GNU/Linux Debian 8.3 > Reporter: Sylvain Maucourt > > I use several services, some of them connect over tcp and the LWT works > properly. > I use several clients from a webapp' connected over a websocket link. > i use a javascript code: > {code:javascript} > var i_am_disconnected = new Paho.MQTT.Message(JSON.stringify({ > version: 1, > state: 0 > })); > i_am_disconnected.destinationName = "device/" + _token + "/ping"; > i_am_disconnected.retained = true; > i_am_disconnected.qos = 1; > client.onConnectionLost = onConnectionLost; > client.connect(… > {code} > i traced the ActiveMQ log, i can see that the disconnection is detected, but > i didn't receive my LWT message. (again, my LWT works when I use a tcp > connexion) > {code} > 2016-07-01 00:07:51,329 | INFO | addConnection() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > info: ConnectionInfo {commandId = 0, responseRequired = true, connectionId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27, clientId = > 60badfb1-3e6d-4637-b4ec-16b557d7db64, clientIp = ws://192.168.0.2:42372, > userName = > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64, > password = *****, brokerPath = null, brokerMasterConnector = false, > manageable = false, clientMaster = true, faultTolerant = false, > failoverReconnect = false} | > com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-40 > 2016-07-01 00:07:51,333 | INFO | addProducer() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > info: ProducerInfo {commandId = 2, responseRequired = true, producerId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27:-1:1, destination = > null, brokerPath = null, dispatchAsync = false, windowSize = 0, sentCount = > 0} | com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-40 > 2016-07-01 00:07:51,423 | INFO | send() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > send: ActiveMQBytesMessage {commandId = 3, responseRequired = true, messageId > = ID:deverylight-all-snapshot-42229-1467323807294-3:27:-1:1:1, > originalDestination = null, originalTransactionId = null, producerId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27:-1:1, destination = > topic://device.bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64.ping, > transactionId = null, expiration = 0, timestamp = 1467324471422, arrival = > 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, > persistent = false, type = null, priority = 4, groupID = null, groupSequence > = 0, targetConsumerId = null, compressed = false, userID = null, content = > org.apache.activemq.util.ByteSequence@335bf90b, marshalledProperties = null, > dataStructure = null, redeliveryCounter = 0, size = 0, properties = > {ActiveMQ.MQTT.QoS=1, ActiveMQ.Retain=true}, readOnlyProperties = true, > readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} > ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null } > payload: {"version":1,"state":2,"timestamp":1467324470.015} | > com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-41 > 2016-07-01 00:07:51,447 | INFO | addConsumer() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > info: ConsumerInfo {commandId = 4, responseRequired = true, consumerId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27:-1:1, destination = > topic://mobile.167e0de6e20b55cc318aacb74f31752e2bffd339.*.position, > prefetchSize = 32767, maximumPendingMessageLimit = 0, browser = false, > dispatchAsync = true, selector = null, clientId = null, subscriptionName = > null, noLocal = false, exclusive = false, retroactive = true, priority = 0, > brokerPath = null, optimizedAcknowledge = false, noRangeAcks = false, > additionalPredicate = null} | > com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-39 > 2016-07-01 00:07:51,451 | INFO | addConsumer() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > info: ConsumerInfo {commandId = 5, responseRequired = true, consumerId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27:-1:2, destination = > topic://mobile.167e0de6e20b55cc318aacb74f31752e2bffd339.*.event, prefetchSize > = 32767, maximumPendingMessageLimit = 0, browser = false, dispatchAsync = > true, selector = null, clientId = null, subscriptionName = null, noLocal = > false, exclusive = false, retroactive = true, priority = 0, brokerPath = > null, optimizedAcknowledge = false, noRangeAcks = false, additionalPredicate > = null} | com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-39 > 2016-07-01 00:08:51,151 | INFO | removeConnection() clientId: > 60badfb1-3e6d-4637-b4ec-16b557d7db64 userName: > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64 > info: ConnectionInfo {commandId = 0, responseRequired = true, connectionId = > ID:deverylight-all-snapshot-42229-1467323807294-3:27, clientId = > 60badfb1-3e6d-4637-b4ec-16b557d7db64, clientIp = ws://192.168.0.2:42372, > userName = > bd525936-5238-4410-9579-79f8dfb27ea4::60badfb1-3e6d-4637-b4ec-16b557d7db64, > password = *****, brokerPath = null, brokerMasterConnector = false, > manageable = false, clientMaster = true, faultTolerant = false, > failoverReconnect = false} | > com.deveryware.deverylight.activemq.TokenAuthenticationBroker | > qtp1143988572-40 > {code} > this is my ActiveMQ configuration > {code} > <transportConnectors> > <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883"/> > <transportConnector name="mqtt+ws" uri="ws://0.0.0.0:9000"/> > </transportConnectors> > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)