What are the major differences between HTTP and COAP?
Asked Answered
D

4

12

HTTP is mainly used for viewing web pages. Coap is a simplified version of HTTP for IoT or WSNs. Although COAP is based on UDP, it should have ACK messages to emulate TCP. Since COAP is simpler than HTTP, it will have lower latency and draw less power.

Then, why browsers and web servers do not replace HTTP with COAP? Given the previous arguments, is it expected that COAP will completely replace HTTP? Is it just a matter of time? Are there any features which are supported only by HTTP?

Dichotomous answered 24/5, 2015 at 14:12 Comment(0)
Q
11

If coap is more efficient, can I say that http is useless in the future if we replace them to coap?

The industry plan is to improve HTTP by moving to HTTP/2, and HTTP/2 includes (amoung other features) a header compression, which should bring you similar benefits than CoAP.

While most web servers and some browsers today support HTTP/2 already, AFAIK no browser nor any server support CoAP. Same goes for TLS vs. DTLS.

Are there features coap cannot support but http can?

As you said, HTTP is TCP based, while CoAP is UDP based. UDP requires that you send UDP pings every few seconds to keep the NAT/Firewall connection open, while in TCP typically it is only required every 15 min or so. So if you need to keep the connection open (e.g. for push technologies), then CoAP is less efficient than HTTP (and HTTP/2).

Quartzite answered 30/5, 2015 at 20:1 Comment(2)
Is CoAP same as HTTP - TCP + UDP (on IPv6)?Timbuktu
As CoAP is not HTTP, its like "CoAP over UDP" is similar to "HTTP over TCP". There are proxies providing this translation see e.g. #43992552Quartzite
B
7

CoAP was never intended to replace HTTP, while it seems to "emulate" http, it only because it follows the REStful Paradigm. CoAP is intended as a application layer for device and more specifically was design for Constraint device.

The REStful design was chosen also to facilitate proxying operation through http (there are recommendation for doing that in the RFC). But again was never intended to replace HTTP.

CoAP is build with small amount of resources in mind. The small header and different feature of CoAP are in place to make sure that constraint device have standards mean to communicate on the internet.

HTTP and CoAP each have their own purpose.

Bolection answered 3/6, 2015 at 21:19 Comment(0)
M
3

CoAP and HTTP con be used for different purposes. CoAP has been implemented for IoT and M2M environment,in other words,to send short messagges using UDP. For instance:

A typical CoAP exchange consists of 2 messages, i.e., a request and a response. In contrast, an HTTP request first requires the client to establish a TCP connection and later terminate it. This results in at least 9 messages for only one request [11]. Note that this argument is not necessarily true for large payloads. After TCP’s slow-start phase, it is able to send multiple packets at once and acknowledge all of them with a single acknowledgement. CoAP’s blockwise transfer [8] though, requires an acknowledgement for each block and leads to more messages and higher transfer time. Since we expect the majority of CoAP messages to be rather short, this is of less importance. However, CoAP’s blockwise mechanism allows a constrained server to not only receive but also process a large request block-by-block. This would not be possible if we used HTTP and TCP. (Scalability for IoT CLoud Services by Martin Lanter)

Actually, Firefox can support CoAP using Copper(CU) plug-in. ;)

Michaella answered 6/10, 2016 at 10:13 Comment(0)
R
2

CoAP is optimized for the resource constrained networks and devices typical of IoT and M2M applications. It uses less resources than HTTP and can provide an environment for communication in WSNs, IoTs, and M2M comm. It is not made to replace HTTP.

HTTP has different application scenarios, while CoAP has a different one. HTTP is mainly designed for Internet devices where the power and other constraints are not an important issues. HTTP is more reliable than CoAP as it uses TCP.

Rotow answered 12/6, 2016 at 5:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.