A lightweight CoAP server implementation supporting essential request methods.
- Supports
GET,POST,PUT, andDELETErequests. - Returns appropriate response codes following RFC 7252 specification.
- Logs all server events, including request details and errors.
- Organizes data in a hierarchical resource structure with unique URLs.
- Handles multiple clients simultaneously with efficient performance.
This server is designed to process requests within an IoT network. Example use cases include:
GET: Retrieve the current temperature from a sensor.POST: Register a new sensor.PUT: Update a sensor's temperature.DELETE: Remove a sensor.
The server returns appropriate error codes based on the RFC 7252 specification:
4.xx– Client-side errors (e.g., bad request, unauthorized access).5.xx– Server-side errors (e.g., internal server failure, unavailable resource).
All errors are logged with timestamps, client IP addresses, request URLs, and response codes.
- Operating System: GNU/Linux (tested on Ubuntu 24.04 and openSUSE Tumbleweed)
- Containerization: Docker, Docker Compose
- Programming Language: Python 3.11
- Package Management: Poetry
- Linter & Formatter: Ruff
- Static Analysis: Mypy
- Testing: Pytest
The server is containerized using Docker to simulate the system architecture. Individual containers represent different components and communicate over a Docker network.
- Server Initialization – Bootstraps the application and sets up necessary configurations.
- Listening for Requests – Handles incoming CoAP requests.
- Request Processing – Responds to
GET,POST,PUT, andDELETErequests.
- Unit Tests – Ensures core functionality is reliable.
- Integration Tests – Validates client-server communication and system stability.
- Manual Tests – Conducted with documented test cases.
- Python 3.11
- Poetry for package management
- Docker (optional)
- Clone the repository:
git clone https://github.com/maksnowak/CoAPServer cd CoAPServer - Build the image:
docker build -t coap_server . - Run the container:
docker run -p 5683:5683 coap_server
- Clone the repository:
git clone https://github.com/maksnowak/CoAPServer cd CoAPServer - Install dependencies:
make install
- Start the server:
make run
This project is open-source and available under the GNU GPLv3 License.
Made with contrib.rocks.