coap 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

Build Status

coap #

A CoAP client library for Dart developers.

The Constrained Application Protocol (CoAP) is a RESTful web transfer protocol for resource-constrained networks and nodes.

COAP is an implementation in Dart providing CoAP-based services to Dart applications.

The code is a port from the C# .NET project CoAP.NET. The dart implementation is that of a CoAP client only, not a server although the CoAP.NET project does supply a server.

The COAP client provides many high level functions to control the request/response nature of the CoAP protocol, fine grained control however can be obtained by users directly constructing their own request messages.

Configuration is achieved by editing a yaml based config file containing many of CoAP protocol configurations.

This is a full implementation of the CoAP protocol including block wise transfer, deduplication, transmission retries using request/response token/id matching, piggy-backed and separate response handling is also supported. Proxying options can be set in request messages however full proxying support is not guaranteed. All CoAP options(if-match, if-none match, uri path/query, location path/query, content format, max age, etags et al.) are supported

Observation of resources is supported with the client 'listening' for observed resource updates when configured for this. The client supports both IPV4 and IPV6 communications and multicast operation. CoAP over DTLS(secure CoAP) is not supported.

Many examples of usage are provided in the examples directory both using a .NET based CoAP server for local testing and testing using the coap.me test server. Also a fully populated default configuration file is present in the examples directory.

1.0.1 #

  • Pana/Pub check updates

1.0.0 #

  • Initial version

example/coap_example.dart

/*
 * Package : Coap
 * Author : S. Hamblett <steve.hamblett@linux.com>
 * Date   : 01/10/2019
 * Copyright :  S.Hamblett
 */

// The example usages for this package are split between this directory and its testserver-example subdirectory.
// This directory contains examples showing basic usage such as ping, discover, put/post etc. and raw request
// handling using the coap.me test server.
//
// The testserver-example directory contains a .NET based CoAP server that can be used for testing purposes on
// a Windows platform. The test server attaches itself to localhost on both IPV4 and IPV6 interfaces and is started
// using the net40server.bat file. The testserver-example directory also contains a README describing the resources
// supported by the server, of particular note is the time_obs_resource example, this shows how query an endpoint for
// observable resources and listen for the observed updates.
//
// A reasonable starting point are the ping examples.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  coap: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:coap/coap.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
collection ^1.14.11 1.14.12
date_format ^1.0.6 1.0.8
event_bus ^1.0.1 1.1.0
executor ^2.1.0 2.2.0
hex ^0.1.2 0.1.2
logging ^0.11.3+2 0.11.3+2
pedantic ^1.5.0 1.9.0
safe_config ^2.0.1 2.0.2
string_scanner ^1.0.5 1.0.5
typed_data ^1.1.6 1.1.6
Transitive dependencies
charcode 1.1.2
meta 1.1.8
path 1.6.4
source_span 1.5.5
stack_trace 1.9.3
term_glyph 1.1.0
yaml 2.2.0
Dev dependencies
test ^1.3.0