コード例 #1
0
        public async Task SendPacketAsync(MqttPacket packet, CancellationToken cancellationToken)
        {
            packet = await InterceptPacketAsync(packet, cancellationToken).ConfigureAwait(false);

            if (packet == null)
            {
                // The interceptor has decided that this packet will not used at all.
                // This might break the protocol but the user wants that.
                return;
            }

            await ChannelAdapter.SendPacketAsync(packet, cancellationToken).ConfigureAwait(false);

            Statistics.HandleSentPacket(packet);
        }