CoAP Hello — UDP Reference

This server speaks CoAP over UDP only, so there is nothing here for a browser to call. Type a name and copy the command for the client you use — the page is static and works straight off disk.

Bundled client — cargo build --release first

Any other CoAP client, e.g. coap-cli

Set COAP_HOST / COAP_PORT to point at another server; both default to 127.0.0.1:5683.

Routes

RequestCodeResponse
GET /hello2.05Hello, World!
GET /hello?name=…2.05Hello, …!
POST /hello2.01Hello, <payload>!
GET /health2.05{"status":"ok","uptime":12}
POST /hello (empty)4.00Bad Request
GET /nope4.04Not Found
PUT /hello4.05Method Not Allowed

CoAP writes response codes as class.detail: 2.05 is HTTP's 200, 4.04 its 404. POST /hello takes raw text or {"name":"…"}.

Scripts

Full request/response suite against a running server

./test-coap.sh

Liveness check — exit 0 healthy, 1 not

./healthcheck.sh -v

Start the server

cargo run --release