COAP Learning Notes--coap resource discovery

Source: Internet
Author: User
Tags json
"Original link" (April 15, 2015, CT statement error, pending modification) More Coap articles please refer to the blog post index-"Internet of things Learning Notes-Index Blog"
The COAP protocol is designed specifically for communication between devices (inter-device communication), where there is little interference in the communication process. In order to work properly without human intervention, COAP provides a resource discovery mechanism. This is where the client understands which URIs are supported, and the client can learn the exact meaning of the URI. The COAP protocol suggests that the server side should support a/.well-known/core that can be accessed by any client. A server dedicated to resource discovery must listen on the default 5683Port. When the client requests the pre-negotiated URI, the server returns a series of URIs. These URIs follow the core link standard. [A simplistic view of the specification is outlined in this post.  The content-type of the response that contains, the list of resources in "CoRE Link Format" is "Application/link-format". This is a newly introduced type, but don't worry about the new type being easy to understand and execute. The core link standard defines a very large number of options, but many of them are not understood in depth, so we have made the appropriate simplification in the design of the code, only to point out some of the options. If you access the pre-negotiated URI/.well-known/core, you will receive the following form of response:
<sensors/temp>;sz=512;title=temperature Sensor;ct=50,<actuators/jack>;sz=256;title=hydraulic Jacks; Ct=50

The above example can help us to understand in depth how the server tells the client what resources are available, and this example provides the following information: There is a device with a URI of "sensors/temp", the device name is "Temperature Sensor". The payload's content type is 50 bytes (Application/json,json format). When you use a Get method to access a resource, the minimum message length is 512 bytes. In addition to the temperature there is another resource, through the above example can be found by a comma separated resources, the URI of the resource is Actuators/jack, the name of the resource is a hydraulic jack, if you use the Get method to access the resource, then the largest packet size is 256 bytes. Payload content is 50 bytes in size (Application/json, format). In addition to these, we encourage you to read the core standards documentation, and if you have a better understanding, please post a blog to share your knowledge.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.