# Context-Aware Gossip-Based Protocol for Internet of Things Applications
## 1 Introduction
In a traditional gossiping protocol, a message is generated by a source and is propagated to the sink node with the active participation of most nodes in the network to ensure that the message is received at the sink [12]. A sender node (beginning with the source node) transmits the message to a single neighbour chosen at random. The selected node then chooses another random neighbour to which to forward the packet. This process is repeated until the message is received at the destination, i.e., the sink node [13]. It is evident from this simple procedure that message redundancy may be an issue, as the same message can be received more than once. Energy is also wasted due to the participation of most of the nodes in the network in the dissemination of a message, directly impacting the network's lifetime. These challenges can potentially be remedied through the utilisation of election scores for optimisation to limit the number of participating nodes. IoT applications can provide access to comprehensive intelligent services and information [1; 14]. This can be achieved by the utilisation of the underlying sensor networks. Therefore, the performance of such application will depend on the communication protocol that facilities the data dissemination among sensors in the network. However, the problem with designing such protocol is tightly related to the underlying sensor network, where sensors have limited resources and capabilities, particularly in terms of power consumption, storage capacity, and bandwidth. In addition, the emerging use of fog computing in IoT applications has raised the need for an efficient multi-hop communication mechanism [15]. In fog computing, sensed data would be sent to the network's edge device (i.e., sink node), rather than a gateway device. This should reduce network traffic and enhance the performance of IoT applications [16]. In smart city environments, communication has been introduced as a customised solution to resolve the issue with Internet connectivity due to obstacles that impede transmission [17; 18]. In a recent smart city project, three different types of stations are considered: (1) sender, (2) sender/receiver, and (3) receiver. Information is gathered from the level of the street (type 1 stations) to the top of the building (type 2 stations) and then to another building (type 3 station). Therefore, the information is passed through the stations as follows: (1) > (2) > (3). The reason for using type 2 stations is because type 1 stations cannot directly communicate to type 3 station due to buildings and obstacles that exist in the way. In addition, stations 1 and 2 do not have Internet connection, while stations 3 do. This solution is illustrated in Figure 1.  
In this paper, a communication mechanism based on a gossiping protocol is proposed. The new protocol utilises knowledge regarding the network context and message priority. The protocol is made context-aware by its ability to gather information about its environment, i.e., neighbors and sink, to adapt its procedure and guide its response accordingly. The main contributions of this paper are threefold. First, a new protocol is proposed that uses a multi-factor weight function (MFWF) to allow the sensors in an IoT network to effectively communicate and propagate messages. This weight function takes several parameters into account: residual energy, Chebyshev distances to neighbouring nodes and to the sink node, node density, and message priority. Second, a simulation model is presented that was built to examine the performance of the proposed protocol in terms of the end-to-end delay, rebroadcast nodes, saved rebroadcasts, and network lifetime by examining each parameter individually. The findings show that the choice among parameters or certain combinations of parameters depends on the application requirements.