public void Stop() { if (_willMessage != null) { _mqttClientSessionsManager.DispatchPublishPacket(this, _willMessage.ToPublishPacket()); } _cancellationTokenSource?.Cancel(false); _cancellationTokenSource?.Dispose(); _cancellationTokenSource = null; _adapter = null; MqttNetTrace.Information(nameof(MqttClientSession), "Client '{0}': Disconnected.", ClientId); }
public void Publish(MqttApplicationMessage applicationMessage) { if (applicationMessage == null) { throw new ArgumentNullException(nameof(applicationMessage)); } _clientSessionsManager.DispatchPublishPacket(null, applicationMessage.ToPublishPacket()); }