コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: MqttServer.cs プロジェクト: skyformat99/MQTTnet
        public void Publish(MqttApplicationMessage applicationMessage)
        {
            if (applicationMessage == null)
            {
                throw new ArgumentNullException(nameof(applicationMessage));
            }

            _clientSessionsManager.DispatchPublishPacket(null, applicationMessage.ToPublishPacket());
        }