async Task InitializeChannelAsync() { Channel = await channelFactory .CreateAsync() .ConfigureAwait(continueOnCapturedContext: false); packetListener = new ClientPacketListener(Channel, flowProvider, configuration); packetListener.Listen(); ObservePackets(); }
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(); }