Skip to content

Commit

Permalink
add client id for each connection
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred2g committed Dec 20, 2023
1 parent 363c2c5 commit cd71d8e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/Mqtt5ClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,21 +2035,27 @@ static int s_TestMqtt5SharedSubscriptionTest(Aws::Crt::Allocator *allocator, voi
std::promise<bool> connectionPromise3;
std::promise<void> stoppedPromise3;

std::shared_ptr<Aws::Crt::Mqtt5::ConnectPacket> packetConnect = std::make_shared<Aws::Crt::Mqtt5::ConnectPacket>();
packetConnect->WithClientId("s_TestMqtt5SharedSubscriptionTest" + Aws::Crt::UUID().ToString());

/* first subscriber */
builder->WithConnectOptions(packetConnect);
s_setupConnectionLifeCycle(builder, connectionPromise, stoppedPromise, "Subscriber 1");
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> mqtt5Client = builder->Build();

ASSERT_TRUE(mqtt5Client);
ASSERT_TRUE(mqtt5Client->Start());

/* second subscriber */
builder2->WithConnectOptions(packetConnect);
s_setupConnectionLifeCycle(builder2, connectionPromise2, stoppedPromise2, "Subscriber 2");
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> mqtt5Client2 = builder2->Build();

ASSERT_TRUE(mqtt5Client2);
ASSERT_TRUE(mqtt5Client2->Start());

/* publisher */
publish_builder->WithConnectOptions(packetConnect);
s_setupConnectionLifeCycle(publish_builder, connectionPromise3, stoppedPromise3, "Publisher");
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> mqtt5Publisher = publish_builder->Build();

Expand Down

0 comments on commit cd71d8e

Please sign in to comment.