UNIT 2 Ip
UNIT 2 Ip
Working of CoAP
Methods in CoAP
GET - The get method is used to retrieve resource information identified by the
request URI. In response to GET method success a 200(OK) response is sent.
POST - The post method creates a new subordinate resource under the parent
URI requested by it to the server. On successful resource creation on the server, a
201 (Created) response is sent while on failure a 200 (OK) response code is sent.
DELETE - The delete method deletes the resource identified by the requested
URI and a 200 (OK) response code is sent on successful operation.
PUT - The PUT method updates or creates the resource identified by the request
URI with the enclosed message body. The message body is considered as
modified version of a resource if it already exists at the specified URI otherwise a
new resource with that URI is created. A 200 (OK) response is received in former
case whereas a 201 (Created) response is received in later case. If the resource is
neither created nor modified then an error response code is sent.
The most fundamental difference between CoAP and HTTP is that CoAP defines a
new method which is not present in HTTP. This method is called Observe method.
The observe method is very similar to the GET method in addition with an observe
option. This alerts the server, to send every update about the resource to the client.
Therefore, upon any change in the resource, the server sends a response to the client.
These responses could either be directly sent individually or they can be piggy-
backed.
CoAP Architecture
As shown it extends normal HTTP clients to clients having resource constraints.
These clients are known as CoAP clients. Proxy device bridges gap between
constained environment and typical internet environment based on HTTP protocols.
Same server takes care of both HTTP and CoAP protocol messages.
CoAP Features
Lightweight and Simple
RESTful Architecture
UDP-Based
Asynchronous Communication
Low Header Overhead
Multicast Communication
Proxy and Caching
Applications of CoAP
Real Time Monitoring in Grid - Smart cities can monitor the distribution and
generation of power remotely. The CoAP sensors could be embedded inside the
transformers and the data could be transferred over GPRS or 6LowPAN.
Defense utilities - The armory and tanks are now-a-days fitted with sensors so
that information could be communicated remotely without any interference. The
CoAP sensors could detect any intrusion. This makes them capable to transfer
more data even under low bandwidth network.
Aircraft utilities - The Aircraft sensors and actuators could be connected with
other sensors and communication can take place using smart CoAP based sensors
and actuators.
Publish-Subscribe Model
This model involves multiple clients interacting with each other, without having any
direct connection established between them. All clients communicate with other
clients only via a third party known as a Broker.
Working of MQTT
Characterstics of MQTT
XMPP is a short form for Extensible Messaging Presence Protocol. It’s protocol for
streaming XML elements over a network in order to exchange messages and present
information in close to real-time.
Let’s dive into each character of word XMPP:
X : It means eXtensible. XMPP is an open-source project which can be changed
or extended according to the need.
M : XMPP is designed for sending messages in real time. It has very efficient
push mechanism compared to other protocols.
P : It determines whether you are online/offline/busy. It indicates the state.
P : XMPP is a protocol, that is, a set of standards that allow systems to
communicate with each other.
XMPP Architecture
On a structural level, XMPP shares great similarities with protocols that work on the
application layer. For example, it also concerns uniquely named clients
communicating over an associated server. Enforcing the protocol as per both clients,
XMPP monitors and handles routing for them.
Even with the use of considerable gateways and domains, one can succeed in
achieving constant connectivity across all the network points with the help of
XMPP.
For example, you must know about XMPP stanzas. These, simply, are the small
XML fragments that are used for starting a communication session. they can be of 3
types:
The presence stanza defines the network or user’s present status to others. For
example, the user/network is online or offline.
Message stanza is a pushing instrument essential for chat messages exchange.
IQ stanza is the element that XMPP utilizes for data requests and modification. Just
as HTTP has GET and POST, XMPP has IQ stanza.
AMQP
Working of AMQP
AMQP operates with both publishers and consumers. The publishers create
the messages, and the consumers take them up and process them. It is the
responsibility of the message broker to guarantee that messages from a
publisher are delivered to the appropriate consumers.
To do this, the broker employs two crucial components:
1. Exchanges
2. Queues.
AMQP Architecture
The difference between MQTT and AMQP is that in AMQP broker is composed of
two components viz. exchange and queues. Both exchange and queues are binded
together.
1. Messaging Model
AMQP provides a sophisticated message queuing model, supporting point-to-point
and publish-subscribe communication patterns. Moreover, it offers a robust
framework for message routing, queuing, and delivery, allowing messages to be
exchanged between applications.
4. Protocol Complexity
AMQP is a feature-rich and comprehensive protocol, offering advanced messaging
capabilities such as message queuing, routing, and complex patterns like request-
response. Its extensive feature set can make it more complicated to implement and
understand, requiring a deeper understanding of the protocol.
5. Security Features
AMQP provides robust security features. These include encryption, authentication,
and access control mechanisms. Moreover, it ensures secure message exchange and
protects against unauthorized access or tampering.
MQTT does not have built-in security features. However, you can use it over secure
transport layers such as SSL/TLS to establish encrypted and authenticated
communication channels. Moreover, you will need to implement additional security
measures to ensure secure messaging.
6. Message Ordering
AMQP guarantees message ordering, ensuring that it delivers messages to
consumers in the same order they sent the messages. This feature is crucial for
applications that require preserving message sequences, such as financial systems or
those with strict message processing dependencies.
MQTT does not provide inherent message ordering guarantees. Messages may be
delivered out of order, particularly in situations with fluctuating network conditions
or multiple subscribers. If maintaining strict message order is essential, handling
ordering constraints necessitates additional application-level logic.
DDS Protocol
DDS protocol uses brokerless architecture in IoT (Internet of Things). DDS stands
for Data Distribution Service.
DDS is a fully distributed GDS (Global Data Space). GDS specifications make it
fully distributed in order to avoid introduction of single point of failure or
bottleneck.
Services:
✅ Publish-Subscribe Model: Devices can publish data to topics, and multiple
subscribers can receive updates efficiently.
✅ QoS Levels:Supports three Quality of Service (QoS) levels (0, 1, 2) to ensure
message delivery based on priority.
✅ Lightweight and Low Bandwidth:Designed for low-power, low-bandwidth
networks, making it ideal for constrained IoT devices.
✅ Persistent Sessions: Retains messages for offline devices when using MQTT
brokers with session persistence.
---
Services:
✅ RESTful Interface:Works like HTTP but optimized for constrained devices.
Supports GET, POST, PUT, DELETE.
✅ UDP-Based Communication:Uses UDP instead of TCP, reducing overhead and
improving response times.
✅ Low Power Consumption:Designed for battery-operated IoT devices that send
occasional data.
✅ Asynchronous Messaging:Uses observe mode for real-time data updates
without frequent polling.
---
Services:
✅ Client-Server Model: Standardized communication using URLs, making it easy
to integrate with web services.
✅ Security with HTTPS:Encrypted communication using SSL/TLS for secure
data transmission.
✅ Interoperability:Works with RESTful APIs, making it compatible with cloud
platforms like AWS, Google Cloud, and Azure.
✅ Stateless Communication: Each request is independent, reducing complexity
but requiring more data per request.
---
Services:
✅ Reliable Message Delivery:Supports store-and-forward mechanisms, ensuring
message persistence.
✅ Multiple Message Queues:Enables priority-based message processing.
✅ Secure Messaging:Provides encryption and authentication features.
✅Enterprise-Grade IoT Communication:Commonly used in large-scale
deployments where guaranteed delivery is crucial.
---
---
Services:
✅ Real-Time Messaging: Supports instant messaging and presence detection.
✅Security:Uses encryption and authentication mechanisms for secure
communication.
✅ Decentralized Architecture: No single point of failure, increasing resilience.
✅ Interoperability: Can work across different IoT platforms and services.
---
Conclusion
Each application layer protocol has its strengths and is suited for specific IoT use
cases.
- MQTT is best for low-power, real-time monitoring applications.
- CoAP is ideal for constrained environments requiring efficient communication.
- HTTP/HTTPS is best for cloud integration and web applications.
- AMQP & DDS are useful for enterprise-grade and real-time IoT systems.
- XMPP excels in messaging-based IoT applications.
USE CASES
Services:
- Smart Lighting (Philips Hue, LIFX): Allows users to control brightness and color
using mobile apps or voice assistants.
- Smart Security (Ring, Nest Cam):Monitors home security with real-time video
streaming and motion detection alerts.
- Smart Thermostats (Nest, Ecobee): Adjusts room temperature based on occupancy
and external weather conditions.
- Voice Assistants (Alexa, Google Home): Enables voice-controlled automation of
smart devices.
---
Services:
- Predictive Maintenance (Siemens MindSphere, GE Predix): Analyzes equipment
performance data to predict failures before they occur.
- SCADA (Supervisory Control and Data Acquisition): Monitors and controls
industrial processes remotely.
- Digital Twin Technology: Creates a digital replica of industrial equipment to
simulate performance and optimize maintenance.
---
Services:
- Wearable Health Trackers (Fitbit, Apple Watch): Monitors heart rate, oxygen
levels, and activity levels in real time.
-Remote Patient Monitoring (RPM): Sends real-time patient vitals (ECG, blood
pressure) to doctors via IoT-enabled devices.
- IoT-Enabled Drug Delivery Systems: Smart insulin pens and connected inhalers
provide personalized medication doses.
Protocols Used: Bluetooth Low Energy (BLE), MQTT, FHIR (Fast Healthcare
Interoperability Resources)
---
4. Smart Agriculture
Use Case:
IoT in agriculture enhances crop yield, conserves water, and automates farming
operations using real-time data from sensors.
Services:
- Precision Farming (John Deere, CropX): Uses IoT sensors to monitor soil
moisture, temperature, and nutrient levels.
- Automated Irrigation Systems: Adjusts water supply based on weather predictions
and soil conditions.
- Livestock Monitoring:Tracks cattle location, health, and breeding cycles using IoT
sensors.
5. Smart Cities
Use Case:
Smart city solutions leverage IoT to optimize traffic management, public safety,
waste collection, and air quality monitoring.
Services
- Smart Traffic Management (Intelligent Traffic Lights, Adaptive Signals): Uses
real-time vehicle data to optimize traffic flow and reduce congestion.
- Smart Waste Management (Enevo, Bigbelly): IoT-enabled trash bins send alerts
when they need to be emptied, optimizing collection routes.
- Air Quality Monitoring (AirVisual, Clarity): Sensors detect pollution levels and
provide real-time environmental data.
---
Services
- Smart Meters (Schneider Electric, Itron): Provides real-time energy usage data to
optimize power consumption.
- Demand Response Systems: Adjusts energy supply based on peak usage times.
- Renewable Energy Integration: Connects solar and wind energy sources to the grid,
enabling efficient distribution.
---
---
Services:
- RFID-Based Inventory Tracking (Amazon Go, Walmart): Uses RFID tags and IoT
sensors to track inventory in real time.
- Automated Checkout (Amazon Just Walk Out): Uses computer vision and IoT
sensors to eliminate checkout lines.
- Cold Chain Monitoring (Zebra, Sensitech):Tracks temperature-sensitive goods like
vaccines and perishable foods during transport.
---
Services:
-Building Management Systems (Honeywell, Siemens BMS):Centralized control of
HVAC, lighting, and security.
- Smart Access Control (Assa Abloy, Kisi): Uses IoT-enabled locks and biometric
authentication for security.
- Energy Optimization:Uses occupancy sensors to control lighting and HVAC based
on real-time usage.
Protocols Used: Zigbee, BACnet, MQTT
---
Services:
- Flood & Earthquake Early Warning Systems: Uses IoT sensors to detect seismic
activity and rising water levels.
- IoT-Based Fire Detection (Smart Smoke Detectors): Sends real-time alerts to
emergency services.
- Air & Water Quality Monitoring (Plume Labs, AirVisual): Measures pollution
levels and provides real-time environmental data.