Robust, ergonomic CoAP server in Rust
An asynchronous CoAP server with a modern and ergonomic API for larger scale applications, inspired by warp and actix. CoAP offers an excellent alternative to HTTP for resource constrained environments like IoT devices.
- Ergonomic: Fluent app-builder API makes it easy to compose rich applications, including those that use more advanced CoAP features.
- Concurrent: High concurrency is supported by using a separate spawned task for each request, allowing long running requests to not interfere with shorter running ones at scale.
- Feature-rich: Conveniently supports a wide range of CoAP server features including Observe, and Block-wise Transfer.
- Flexible: Supports pluggable transport backends with goals of supporting alternative async runtimes like embassy.
Example
use ;
use ;
async
async
To experiment, I recommend using the excellent coap-client command-line tool, as with:
$ coap-client -m get coap://localhost/hello
Hello, world
See examples for more.
Features
This project aims to be a robust and complete CoAP server, and in particular a more convenient alternative to MQTT for Rust-based projects:
- Correct and convenient Observe support (RFC 7641)
- Block-wise transfer support (RFC 7959)
- Resource discovery and filtering via
/.well-known/core(RFC 6690) - Multicast UDP
- Fully concurrent request handling (no head-of-line blocking or scaling surprises!)
- Ping/Pong keep-alive messages
Desired but not implemented:
- Non-piggybacked responses
- Secure transports (OSCORE and DTLS)
Related Projects
- martindisch/coap-lite: used by this project as the low-level basis for CoAP protocol support
- Covertness/coap-rs: original server
I used but outgrew when I needed more robust features like generic Observe
support and
/.well-known/corefiltering. - ryankurte/rust-coap-client: inspired the creation of this crate based on the excellent generalization of client backends
- google/rust-async-coap