Choosing a data exchange protocol
You need to choose a proper data exchange protocol to establish efficient communication between the prototype components. The choice is largely dependent on the communication function for which you intend to use the protocol. The functions are described by the Open Systems Interconnection (OSI) model. Note that some protocols can cover multiple functions.
The OSI model divides a communication system into a number of abstraction layers (originally seven, as shown in the following table). Each layer is responsible for its specific jobs (functions), servicing the instances from an above layer and requesting services from an underlying one.
The following table shows seven layers of the OSI model:
Layer Protocol data unit Function
1. Physical Bit Transmitting and receiving of raw bit streams through a physical medium
2. Data link Frame Dependable transmission of data frames bounded by two nodes connected by a physical layer
3. Network Packet Configuring and managing a multi-node network, involving addressing, routing, and traffic control
4. Transport Segment (TCP)/Datagram (UDP) Dependable transmission of data segments bounded by points on a network, inclusive of parting, acknowledgement, and multiplexing
5. Session Data Governing communication period, that is, consecutive change of data in the form of multiple back-and-forth conveyance between two nodes
6. Presentation Data Transcription of data among a networking benefit and an exercise, including character encoding, data confining, and encryption/decryption
7. Application Data High-level APIs, together with resource sharing, remote file access
Unlike web applications, IoT devices send really small amounts of data, but frequently. This means that transfer of IoT data can be optimized on the application (P2P, AMQP), transport (Modbus, OPC UA), network (Zigbee), or even physical (NB-IoT) layers (see the preceding table).
Devices may be connected directly to a cloud, through a hub, or in a mesh network where they can communicate with each other.
The subsequent chapters cover the following four protocols in more detail—HTTP, WebSocket, Modbus, and OPC UA.