/* * Terminates a connection to the message broker. */ //synchronized // [MethodImpl(MethodImplOptions.Synchronized)] public void disconnectFromBroker(bool reconnect) { try { if (mqttConnection != null) { disconnectCalled = !reconnect; mqttConnection.disconnect(new DisconnectCB(reconnect, this)); mqttConnection = null; } setConnectionStatus(MQTTConnectionStatus.NOTCONNECTED_UNKNOWNREASON); } catch (Exception e) { } }