コード例 #1
0
ファイル: MqttClientImpl.cs プロジェクト: jangocheng/mqtt-2
        async Task InitializeChannelAsync()
        {
            Channel = await channelFactory
                      .CreateAsync()
                      .ConfigureAwait(continueOnCapturedContext: false);

            packetListener = new ClientPacketListener(Channel, flowProvider, configuration);
            packetListener.Listen();
            ObservePackets();
        }
コード例 #2
0
        internal MqttClientImpl(IMqttChannel <IPacket> packetChannel,
                                IProtocolFlowProvider flowProvider,
                                IRepositoryProvider repositoryProvider,
                                IPacketIdProvider packetIdProvider,
                                MqttConfiguration configuration)
        {
            receiver = new ReplaySubject <MqttApplicationMessage> (window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs));
            sender   = new ReplaySubject <IPacket> (window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs));

            this.packetChannel    = packetChannel;
            this.flowProvider     = flowProvider;
            sessionRepository     = repositoryProvider.GetRepository <ClientSession> ();
            this.packetIdProvider = packetIdProvider;
            this.configuration    = configuration;
            clientSender          = TaskRunner.Get();
            packetListener        = new ClientPacketListener(packetChannel, flowProvider, configuration);

            packetListener.Listen();
            ObservePackets();
        }