Skip to content

A Java Library for implementing CoAP clients and servers.

License

Notifications You must be signed in to change notification settings

google/coapblaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CoapBlaster

CoapBlaster is an experimental open-source CoAP client/server library written in Java.

Design Goals

The initial design goals for CoapBlaster were best approximated as the following:

  • Full RFC7252 support
  • Flexible, easy-to-use API that supports both synchronous and asynchronous design patterns
  • Robust, easy-to-use resource observation
  • Easily swappable back-end to support various transports
  • Full support for DTLS, COSE, and possibly OSCORE

Most of these goals have already been met, while a few are still in progress.

Note that because CoapBlaster is still at the experimental/preview stage, it should not be considered production ready.

Current Features

Currently, CoapBlaster supports the following:

  • Full RFC7252 support for the Constrained Application Protocol
    • Retransmission/deduplication support
    • Tunable transmission parameters
  • API allows for both asynchronous and synchronous usage
  • Supports sending and receiving asynchronous CoAP responses
  • Effortless RFC7641 observation support
  • Support for block2 transfers on both client and server interfaces
  • Support for parsing and composing RFC6690-style link formats
  • Support for diverting client requests through a CoAP proxy

Planned Features

Documentation

Usage Examples

Fetching a simple resource

Program:

import com.google.iot.m2m.LocalEndpointManager;
import com.google.iot.m2m.Client;
import com.google.iot.m2m.Transaction;
import com.google.iot.m2m.Message;

LocalEndpointManager manager = new LocalEndpointManager();

Client client = new Client(manager, "coap://coap.me/test");

Transaction transaction = client.newRequestBuilder().send();

try {
    Message response = transaction.getResponse();
    System.out.println("Got response: " + response);

} catch(Exception exception) {
    System.out.println("Exception: " + exception);
}

Which will print out a long line which looks something like this:

<CONTENT IN ACK MID:44712 TOK:"f43c" 2.05 RADDR:"/134.102.218.18:5683" OPTS:[ETag:thZhiYJXp/I=, Content-Format:0] TEXT:"welcome to the ETSI plugtest! last change: 2018-1...">

Additional Examples

Building and Installing

This project uses Maven for building. Once Maven is installed, you should be able to build and install the project by doing the following:

mvn verify
mvn install

Note that the master branch of this project depends on CborTree, so you may need to download, build, and install that project first.

Adding to Projects

Gradle:

dependencies {
  compile 'com.google.iot.coap:coap:0.02.01'
}

Maven:

<dependency>
  <groupId>com.google.iot.coap</groupId>
  <artifactId>coap</artifactId>
  <version>0.02.01</version>
</dependency>

Building and Installing

This project uses Maven for building. Once Maven is installed, you should be able to build and install the project by doing the following:

mvn verify
mvn install

Note that the master branch of this project depends on CborTree, so you may need to download, build, and install those projects first.

See Also

License

CoapBlaster is released under the Apache 2.0 license.

Copyright 2018 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Disclaimer

This is not an officially supported Google product.

About

A Java Library for implementing CoAP clients and servers.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages