mjCoAP: An Open-Source Lightweight Java CoAP Library for Internet of Things Applications

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9001)


The Internet of Things (IoT) is expected to pervasively interconnect more than 50 billion devices, denoted as “smart objects”, by 2020 in an Internet-like structure, which will extend the current Internet, enabling new forms of interaction between physical objects and people. The IoT will be made up of heterogeneous devices, featuring extremely diverse capabilities, in terms of computational power, connectivity, availability, and mobility. In such a scenario, characterized by the heterogeneity and large number of involved devices, in order to effectively allow and foster the growth of new applications and services, it is necessary to provide appropriate standards that can guarantee full interoperability among existing hosts and IoT nodes. Standardization organizations, such as the Internet Engineering Task Force (IETF), and research projects are chartered to bring IP to smart objects and to define suitable application-layer and security protocols for IoT scenarios. In order to cope with the limitations of smart objects, the IETF CoRE Working Group has defined the Constrained Application Protocol (CoAP), a standard application-layer protocol for use with constrained nodes and constrained networks. In this work, we present mjCoAP, an open source lightweight Java-based implementation of CoAP, which aims at simplifying the development of CoAP-based IoT applications. The mjCoAP library is fully RFC-compliant and integrates several IETF CoRE WG specifications, such as blockwise transfers, resource observing, and HTTP/CoAP mapping. We also present some application scenarios and we describe how they can be easily implemented based on mjCoAP.


Internet of Things CoAP Application-layer protocols Interoperability Standardization 



The work of Simone Cirani and Luca Veltri is funded by the European Community’s Seventh Framework Programme, area “Internetconnected Objects”, under Grant no. 288879, CALIPSO project - Connect All IP-based Smart Objects! The work reflects only the authors views; the European Community is not liable for any use that may be made of the information contained herein. The work of Marco Picone is funded by Guglielmo srl, Reggio Emilia (RE), Italy.


  1. 1.
    European Community’s 7th Framework Programme: CALIPSO - Connect All IP-based Smart Objects. URL
  2. 2.
    IETF Constrained RESTful Environments Working Group.
  3. 3.
    Shelby, Z., Hartke, K., Bormann, C.: The Constrained Application Protocol (CoAP). RFC 7252 (Proposed Standard), June 2014Google Scholar
  4. 4.
    Fielding, R.T.: Architectural styles and the design of network-based software architectures. Ph.D. thesis, University of California, Irvine, AAI9980887 (2000)Google Scholar
  5. 5.
    Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T.: Hypertext Transfer Protocol. HTTP 1.1. RFC 2616 (Draft Standard), June 1999. Obsoleted by RFCs 7230, 7231, 7232, 7233, 7234, 7235, updated by RFCs 2817, 5785, 6266, 6585Google Scholar
  6. 6.
    MQTT: Message Queue Telemetry Transport.
  7. 7.
    Vinoski, S.: Advanced message queuing protocol. IEEE Internet Comput. 10(6), 87–89 (2006)CrossRefGoogle Scholar
  8. 8.
    European Community’s 7th Framework Programme: Universal Integration of Internet of Things Through an IPv6-Based Service Oriented Architecture Enabling Heterogeneous Components Interoperability (2011).
  9. 9.
    European Community’s 7th Framework Programme: OpenIoT: Open Source Cloud Solution for the Internet of Things (2012).
  10. 10.
    Rescorla, E., Modadugu, N.: Datagram Transport Layer Security. RFC 4347 (Proposed Standard), April 2006. Obsoleted by RFC 6347, updated by RFC 5746Google Scholar
  11. 11.
    Dierks, T., Rescorla, E.: The Transport Layer Security (TLS) protocol version 1.1. RFC 4346 (Proposed Standard), April 2006. Obsoleted by RFC 5246, updated by RFCs 4366, 4680, 4681, 5746, 6176Google Scholar
  12. 12.
    Castellani, A., Loreto, S., Rahman, A., Fossati, T.: Guidelines for HTTP-CoAP Mapping Implementations. Internet-Draft draft-ietf-core-http-mapping-04, Internet Engineering Task Force, July 2014Google Scholar
  13. 13.
    Shelby, Z., Bormann, C.: Blockwise transfers in CoAP. Internet-Draft draft-ietf-core-block-15, Internet Engineering Task Force, July 2014, Work in progressGoogle Scholar
  14. 14.
    Hartke, K.: Observing Resources in CoAP. Internet-Draft draft-ietf-core-observe-14, Internet Engineering Task Force, June 2014Google Scholar
  15. 15.
    Shelby, Z., Bormann, C., Krco, S.: CoRE Resource Directory. Internet-Draft draft-ietf-core-resource-directory-01, Internet Engineering Task Force (Proposed standard), December 2013Google Scholar
  16. 16.
    Nottingham, M.: Web Linking. RFC 5988 (Proposed Standard), October 2010Google Scholar
  17. 17.
    Shelby, Z.: Constrained RESTful Environments (CoRE) Link Format. RFC 6690 (Proposed Standard), August 2012Google Scholar
  18. 18.
    Kovatsch, M., Lanter, M., Shelby, Z.: Californium: Scalable cloud services for the Internet of things with CoAP. In: Proceedings of the 4th International Conference on the Internet of Things (IoT 2014), Cambridge, MA, USA, October 2014Google Scholar
  19. 19.
    The Contiki Operating System.
  20. 20.
  21. 21.
    Kovatsch, M., Duquennoy, S., Dunkels, A.: A low-power CoAP for Contiki. In: 2011 IEEE 8th International Conference on Mobile Adhoc and Sensor Systems (MASS), pp. 855–860, October 2011Google Scholar
  22. 22.
    Kovatsch, M.: Demo abstract: human-CoAP interaction with copper. In: Proceedings of the 7th IEEE International Conference on Distributed Computing in Sensor Systems (DCOSS 2011), Barcelona, Spain, June 2011Google Scholar
  23. 23.
  24. 24.
    mjCoAP (2014).
  25. 25.
    Cirani, S., Picone, M., Veltri, L.: CoSIP: a constrained session initiation protocol for the Internet of things. In: Canal, C., Villari, M. (eds.) Advances in Service-Oriented and Cloud Computing. CCIS, vol. 393, pp. 13–24. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  26. 26.
    Cirani, S., Picone, M., Veltri, L.: A session initiation protocol for the Internet of things. Scalable Comput. Pract. Exp. 14(4), 249–263 (2014)Google Scholar
  27. 27.
    Cirani, S., Davoli, L., Picone, M., Veltri, L.: Performance evaluation of a SIP-based constrained peer-to-peer overlay. In: 2014 International Conference on High Performance Computing Simulation (HPCS), pp. 432–435 (2014)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Department of Information EngineeringUniversity of ParmaParmaItaly

Personalised recommendations