private void ProcessSubscription() { SubAck ack = new SubAck(_command.MessageId); Subscribe subCmd = _command as Subscribe; foreach (Subscription sub in subCmd.Subscriptions) { ack.Grants.Add(QualityOfService.AtMostOnce); } _connection.Send(new SubAck(_command.MessageId)); _connection.Complete(_command); }
public override void Start() { switch (_command.Header.QualityOfService) { case QualityOfService.AtMostOnce: _connection.Complete(_command); break; case QualityOfService.AtLeastOnce: _connection.Send(new PubAck(_command.MessageId)); _connection.Complete(_command); break; case QualityOfService.ExactlyOnce: _connection.Send(new PubRec(_command.MessageId)); WaitFor(_connection, _command.MessageId.Value, CommandMessage.PUBREL).Await(); _connection.Send(new PubComp(_command.MessageId)); _connection.Complete(_command); break; default: throw new InvalidOperationException("Unknown QoS"); } }
private void ProcessSubscription() { var subCmd = _command as Subscribe; if (subCmd == null) { throw new InvalidOperationException("Command was not of type Subscribe"); } var ack = new SubAck(_command.MessageId); foreach (Subscription sub in subCmd.Subscriptions) { ack.Grants.Add(QualityOfService.AtMostOnce); } _connection.Send(new SubAck(_command.MessageId)); _connection.Complete(_command); }
public override void Start() { _connection.Send(new PingResp()); _connection.Complete(_command); }