Research Article

Improving Topic-Based Data Exchanges among IoT Devices

Algorithm 1

TBRouting.
(1)procedure TBRouting.
(2) When a broker receives data with topics from one client, the broker matches topics in its topic tree.
(3) If the node is just the terminal subscriber, then broker forwards it to that node, and then go to 5. If the node is not the terminal consumer of the topic, go to 4.
(4) If the node is not the terminal consumer of the topic, the data will be forwarded to the other broker nodes, which is the next hop of the routing.
(5) Continuing with 3, with next hop, data eventually will be sent to cloud or terminal nodes. The messages are sent with the shortest path to the final destination.
(6) The topic may be sent to many different receivers who subscribe the topics. All the receivers will receive the same messages.
(7) The broker will decide whether to store the topic or not.